22
33namespace Phpmig \Api ;
44
5- use Phpmig \ Api \ PhpmigApplication ;
5+ use PHPUnit \ Framework \ TestCase ;
66use Symfony \Component \Console \Output ;
77
88/**
99 * @group unit
10- * @coversDefaultClass Phpmig\Api\ PhpmigApplication
10+ * @coversDefaultClass PhpmigApplication
1111 *
1212 * @author Cody Phillips
1313 */
14- class PhpmigApplicationTest extends \PHPUnit_Framework_TestCase
14+ class PhpmigApplicationTest extends TestCase
1515{
1616 private $ prev_version = '20141104210000 ' ;
1717 private $ current_version = '20141104220000 ' ;
1818 private $ next_version = '20141104230000 ' ;
1919 private $ output ;
2020 private $ temp_dir ;
2121
22- public function setup ()
22+ public function setUp (): void
2323 {
2424 $ this ->output = new Output \NullOutput ();
2525 $ this ->setTempDir ($ this ->makeTempDir ());
2626 }
2727
28- public function tearDown ()
28+ public function tearDown (): void
2929 {
30- $ this ->cleanTempDir ($ this -> getTempDir () );
30+ $ this ->cleanTempDir ();
3131 }
3232
3333 /**
@@ -121,7 +121,6 @@ public function testGetMigrations()
121121 * @covers ::getMigrations
122122 * @covers ::loadMigrations
123123 * @covers ::migrationToClassName
124- * @expectedException \InvalidArgumentException
125124 * @dataProvider getMigrationsExceptionProvider
126125 */
127126 public function testGetMigrationsException ($ migrations , $ class_names , $ extends )
@@ -135,6 +134,7 @@ public function testGetMigrationsException($migrations, $class_names, $extends)
135134 $ container = $ this ->getContainer ($ adapter , $ migrations , $ this ->getTempDir ());
136135
137136 $ app = new PhpmigApplication ($ container , $ this ->output );
137+ $ this ->expectException (\InvalidArgumentException::class);
138138 $ app ->getMigrations (0 );
139139 }
140140
@@ -208,7 +208,7 @@ public function testGetVersion()
208208 */
209209 protected function getAdapter (array $ versions = array ())
210210 {
211- $ adapter = $ this ->getMock ('Phpmig\Adapter\AdapterInterface ' );
211+ $ adapter = $ this ->createMock ('Phpmig\Adapter\AdapterInterface ' );
212212 $ adapter ->expects ($ this ->any ())
213213 ->method ('fetchAll ' )
214214 ->will ($ this ->returnValue ($ versions ));
@@ -225,7 +225,7 @@ protected function getAdapter(array $versions = array())
225225 */
226226 protected function getMigrator ($ adapter , $ container , $ output , $ times_up , $ times_down )
227227 {
228- $ migrator = $ this ->getMock ("Phpmig\Migration\Migrator " , array ("up " , "down " ), array ($ adapter , $ container , $ output ));
228+ $ migrator = $ this ->createMock ("Phpmig\Migration\Migrator " , array ("up " , "down " ), array ($ adapter , $ container , $ output ));
229229 if ($ times_up > 0 ) {
230230 $ migrator ->expects ($ this ->exactly ($ times_up ))
231231 ->method ("up " )
0 commit comments