dev-master
9999999-devMigrate your tests to newest PHPUnit version
BSD-2-Clause
The Requires
Migrate your tests to newest PHPUnit version
Migrate project to the newest version of PHPUnit., (*2)
[Work In Progress] Use it on the own risk :), (*3)
Clone the project:, (*4)
$ git clone https://github.com/webimpress/phpunit-migration.git
Go into the directory and install dependencies:, (*5)
$ cd phpunit-migration $ composer install
To update your project to the newest version of PHPUnit go to your project directory and run:, (*6)
$ ../path/to/phpunit-migration/bin/phpunit-migration migrate
\PHPUnit_Framework_TestCase
to namespaced \PHPUnit\Framework\TestCase
,setExpectedException
to expectException*
,setUp
and tearDown
to protected
and correct case (setup
=> setUp
etc.),@cover
tag (i.e. @covers MyClass
to @covers \MyClass
),assertInternalType
and assertNotInternalType
to more specific assertion method (PHPUnit 7.5+),getMock
to getMockBuilder
with other required function calls (PHPUnit 5.4+),getMockBuilder(...)->...->getMock()
to createMock(...)
if possible (PHPUnit 5.4+),assertEquals()
and assertNotEquals()
with $delta
, $maxDepth
, $canonicalize
and $ignoreCase
parameters to more specific assertion method (PHPUnit 7.5+),setUp()
, tearDown()
, setUpBeforeClass()
, tearDownAfterClass()
,
assertPreConditions()
, assertPostConditions()
, onNotSuccessfulTest(\Throwable $th)
(PHPUnit 8.0+),expectExceptionMessageRegExp
to expectExceptionMessageMatches
(PHPUnit 8.4+),assertNotIsReadable
replaced by assertIsNotReadable'
,assertNotIsWritable
replaced by assertIsNotWritable'
,assertDirectoryNotExists
replaced by assertDirectoryDoesNotExist'
,assertDirectoryNotIsReadable
replaced by assertDirectoryIsNotReadable'
,assertDirectoryNotIsWritable
replaced by assertDirectoryIsNotWritable'
,assertFileNotExists
replaced by assertFileDoesNotExist'
,assertFileNotIsReadable
replaced by assertFileIsNotReadable'
,assertFileNotIsWritable
replaced by assertFileIsNotWritable'
,assertRegExp
replaced by assertMatchesRegularExpression'
,assertNotRegExp
replaced by assertDoesNotMatchRegularExpression'
.
(PHPUnit 9.1+),getMockBuilder(...)->...->setMethods(...)->getMock()
to createPartialMock(...)
if possible
(PHPUnit 5.5.3+),assertContains()
and assertNotContains()
on string
haystack to more specific assertion method
(PHPUnit 7.5+),$this->assert
to self::assert
.PHPUnit_Framework_Error_*
classesNote
Please remember it is developer tool and it should be used only as a helper to migrate your tests to newer version of PHPUnit. Always after migration run all your test to verify if applied changes are right and your tests are still working!, (*7)
Migrate your tests to newest PHPUnit version
BSD-2-Clause