From a038565ab24c1f4b89e78eaeff50a9114ddded9c Mon Sep 17 00:00:00 2001 From: Coen Jacobs Date: Tue, 5 Feb 2019 11:28:01 +0100 Subject: [PATCH 01/12] Strip core migrations principle --- src/Exceptions/ReservedNameException.php | 9 ----- src/Handler.php | 48 +----------------------- 2 files changed, 1 insertion(+), 56 deletions(-) delete mode 100644 src/Exceptions/ReservedNameException.php diff --git a/src/Exceptions/ReservedNameException.php b/src/Exceptions/ReservedNameException.php deleted file mode 100644 index 9d3a9ac..0000000 --- a/src/Exceptions/ReservedNameException.php +++ /dev/null @@ -1,9 +0,0 @@ -worker = $worker; $this->logger = $logger; $this->logger->setWorker($this->worker); - - $this->setupCoreMigrations(); - } - - private function setupCoreMigrations() - { - $this->add('core', CreateMigrationsTable::class); - - // From here on, the 'core' index as $plugin_key is a reserved name and - // can't be used by anyone else. - $this->reservedNames = [ - 'core' - ]; - } - - /** - * @param string $pluginKey - * @return bool - */ - public function isReservedName($pluginKey) - { - return in_array($pluginKey, $this->reservedNames); } /** * @param string $pluginKey * @param $migrationClassName - * @throws ReservedNameException */ public function add($pluginKey, $migrationClassName) { - if ($this->isReservedName($pluginKey)) { - throw new ReservedNameException($pluginKey . ' is a reserved name and can not be used by implementations.'); - } - $this->migrations[ $pluginKey ][] = $migrationClassName; } @@ -74,29 +45,17 @@ public function add($pluginKey, $migrationClassName) * Core migrations will always be run first to setup base tables for logging. * * @param string $pluginKey - * @throws ReservedNameException */ public function up($pluginKey) { - if ($this->isReservedName($pluginKey)) { - throw new ReservedNameException($pluginKey . ' is a reserved name and can not be used by implementations.'); - } - if (! isset($this->migrations[ $pluginKey ])) { return; } - $runMigrations = $this->logger->getLoggedMigrations(['core', $pluginKey]); + $runMigrations = $this->logger->getLoggedMigrations([$pluginKey]); $migrationsToRun = []; - // Add core migrations first - foreach ($this->migrations[ 'core' ] as $migrationClass) { - if (! in_array($migrationClass::id(), $runMigrations)) { - $migrationsToRun['core'][] = new $migrationClass($this->worker); - } - } - // Add added migrations for $pluginKey second foreach ($this->migrations[ $pluginKey ] as $migrationClass) { if (! in_array($migrationClass::id(), $runMigrations)) { @@ -112,14 +71,9 @@ public function up($pluginKey) * Core migrations will not be reversed since they can still be used by another plugin. * * @param string $pluginKey - * @throws ReservedNameException */ public function down($pluginKey) { - if ($this->isReservedName($pluginKey)) { - throw new ReservedNameException($pluginKey . ' is a reserved name and can not be used by implementations.'); - } - if (! isset($this->migrations[ $pluginKey ])) { return; } From 5afc747af054006192afbcbab6ceb04c83b6368b Mon Sep 17 00:00:00 2001 From: Coen Jacobs Date: Tue, 5 Feb 2019 11:28:22 +0100 Subject: [PATCH 02/12] Have DatabaseLogger register its own migration --- src/Loggers/DatabaseLogger.php | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/Loggers/DatabaseLogger.php b/src/Loggers/DatabaseLogger.php index 3c44190..897f71d 100644 --- a/src/Loggers/DatabaseLogger.php +++ b/src/Loggers/DatabaseLogger.php @@ -3,17 +3,31 @@ namespace CoenJacobs\Migrator\Loggers; use CoenJacobs\Migrator\Contracts\Migration; +use CoenJacobs\Migrator\Handler; +use CoenJacobs\Migrator\Migrations\CreateMigrationsTable; class DatabaseLogger extends BaseLogger { + /** @var string */ + protected $tableName; + + public function setTableName($tableName) + { + $this->tableName = $tableName; + } + + public function registerMigration($pluginKey, Handler $handler) + { + $handler->add($pluginKey, CreateMigrationsTable::class); + } + public function add($plugin_key, Migration $migration, $batch) { $id = $migration->id(); - $tableName = $this->worker->getPrefix() . 'migrator_migrations'; $batch = intval($batch); - $query = "INSERT INTO $tableName (migration, plugin_key, batch) + $query = "INSERT INTO $this->tableName (migration, plugin_key, batch) VALUES ('$id', '$plugin_key', '$batch')"; $this->worker->query($query); } @@ -21,8 +35,7 @@ public function add($plugin_key, Migration $migration, $batch) public function remove($plugin_key, Migration $migration) { $id = $migration->id(); - $tableName = $this->worker->getPrefix() . 'migrator_migrations'; - $query = "DELETE FROM $tableName (migration, plugin_key) + $query = "DELETE FROM $this->tableName (migration, plugin_key) VALUES ('$id', '$plugin_key')"; $this->worker->query($query); } @@ -30,12 +43,11 @@ public function remove($plugin_key, Migration $migration) public function getLoggedMigrations($plugin_keys) { $databaseName = $this->worker->getDatabaseName(); - $tableName = $this->worker->getPrefix() . 'migrator_migrations'; // Check if table exists before we try to query it $query = "SELECT count(*) FROM information_schema.TABLES - WHERE (TABLE_SCHEMA = '$databaseName') AND (TABLE_NAME = '$tableName')"; + WHERE (TABLE_SCHEMA = '$databaseName') AND (TABLE_NAME = '$this->tableName')"; $result = $this->worker->getResults($query); @@ -43,7 +55,7 @@ public function getLoggedMigrations($plugin_keys) return []; } - $query = 'SELECT migration FROM '.$tableName.' + $query = 'SELECT migration FROM '.$this->tableName.' WHERE plugin_key IN ("'. implode('","', $plugin_keys) .'")'; $results = $this->worker->getResults($query); @@ -59,12 +71,11 @@ public function getLoggedMigrations($plugin_keys) public function getHighestBatchNumber() { $databaseName = $this->worker->getDatabaseName(); - $tableName = $this->worker->getPrefix() . 'migrator_migrations'; // Check if table exists before we try to query it $query = "SELECT count(*) FROM information_schema.TABLES - WHERE (TABLE_SCHEMA = '$databaseName') AND (TABLE_NAME = '$tableName')"; + WHERE (TABLE_SCHEMA = '$databaseName') AND (TABLE_NAME = '$this->tableName')"; $result = $this->worker->getResults($query); @@ -72,8 +83,7 @@ public function getHighestBatchNumber() return 0; } - $tableName = $this->worker->getPrefix() . 'migrator_migrations'; - $query = 'SELECT MAX(batch) AS batch FROM '.$tableName.';'; + $query = 'SELECT MAX(batch) AS batch FROM '.$this->tableName.';'; $results = $this->worker->getResults($query); if (empty($results)) { From a25cebc48a1c0e604666aa226d2ae3d7cfc00ebf Mon Sep 17 00:00:00 2001 From: Coen Jacobs Date: Tue, 5 Feb 2019 11:55:19 +0100 Subject: [PATCH 03/12] Setup migrations table migration separate from flow --- src/Loggers/DatabaseLogger.php | 63 ++++++++++++------------ src/Migrations/CreateMigrationsTable.php | 16 +++--- 2 files changed, 42 insertions(+), 37 deletions(-) diff --git a/src/Loggers/DatabaseLogger.php b/src/Loggers/DatabaseLogger.php index 897f71d..3f1396d 100644 --- a/src/Loggers/DatabaseLogger.php +++ b/src/Loggers/DatabaseLogger.php @@ -3,7 +3,6 @@ namespace CoenJacobs\Migrator\Loggers; use CoenJacobs\Migrator\Contracts\Migration; -use CoenJacobs\Migrator\Handler; use CoenJacobs\Migrator\Migrations\CreateMigrationsTable; class DatabaseLogger extends BaseLogger @@ -11,18 +10,41 @@ class DatabaseLogger extends BaseLogger /** @var string */ protected $tableName; - public function setTableName($tableName) + public function __construct($tableName) { $this->tableName = $tableName; } - public function registerMigration($pluginKey, Handler $handler) + public function init() { - $handler->add($pluginKey, CreateMigrationsTable::class); + if (!$this->isTableSetup()) { + $migration = new CreateMigrationsTable($this->worker); + $migration->setTableName($this->tableName); + $migration->up(); + } + } + + public function isTableSetup() + { + $databaseName = $this->worker->getDatabaseName(); + + // Check if table exists before we try to query it + $query = "SELECT count(*) + FROM information_schema.TABLES + WHERE (TABLE_SCHEMA = '$databaseName') AND (TABLE_NAME = '$this->tableName')"; + + $result = $this->worker->getResults($query); + + if (empty($result) || $result[0]->{"count(*)"} == 0) { + return false; + } + + return true; } public function add($plugin_key, Migration $migration, $batch) { + $this->init(); $id = $migration->id(); $batch = intval($batch); @@ -34,6 +56,7 @@ public function add($plugin_key, Migration $migration, $batch) public function remove($plugin_key, Migration $migration) { + $this->init(); $id = $migration->id(); $query = "DELETE FROM $this->tableName (migration, plugin_key) VALUES ('$id', '$plugin_key')"; @@ -42,21 +65,10 @@ public function remove($plugin_key, Migration $migration) public function getLoggedMigrations($plugin_keys) { - $databaseName = $this->worker->getDatabaseName(); + $this->init(); - // Check if table exists before we try to query it - $query = "SELECT count(*) - FROM information_schema.TABLES - WHERE (TABLE_SCHEMA = '$databaseName') AND (TABLE_NAME = '$this->tableName')"; - - $result = $this->worker->getResults($query); - - if (empty($result) || $result[0]->{"count(*)"} == 0) { - return []; - } - - $query = 'SELECT migration FROM '.$this->tableName.' - WHERE plugin_key IN ("'. implode('","', $plugin_keys) .'")'; + $query = 'SELECT migration FROM ' . $this->tableName . ' + WHERE plugin_key IN ("' . implode('","', $plugin_keys) . '")'; $results = $this->worker->getResults($query); @@ -70,20 +82,9 @@ public function getLoggedMigrations($plugin_keys) public function getHighestBatchNumber() { - $databaseName = $this->worker->getDatabaseName(); - - // Check if table exists before we try to query it - $query = "SELECT count(*) - FROM information_schema.TABLES - WHERE (TABLE_SCHEMA = '$databaseName') AND (TABLE_NAME = '$this->tableName')"; - - $result = $this->worker->getResults($query); - - if (empty($result) || $result[0]->{"count(*)"} == 0) { - return 0; - } + $this->init(); - $query = 'SELECT MAX(batch) AS batch FROM '.$this->tableName.';'; + $query = 'SELECT MAX(batch) AS batch FROM ' . $this->tableName . ';'; $results = $this->worker->getResults($query); if (empty($results)) { diff --git a/src/Migrations/CreateMigrationsTable.php b/src/Migrations/CreateMigrationsTable.php index 41d6286..e25c494 100644 --- a/src/Migrations/CreateMigrationsTable.php +++ b/src/Migrations/CreateMigrationsTable.php @@ -4,16 +4,22 @@ class CreateMigrationsTable extends BaseMigration { + /** @var string */ + protected $tableName; + public static function id() { return 'migrator-1-migrations-table'; } - public function up() + public function setTableName($tableName) { - $tableName = $this->worker->getPrefix() . 'migrator_migrations'; + $this->tableName = $tableName; + } - $query = "CREATE TABLE $tableName ( + public function up() + { + $query = "CREATE TABLE $this->tableName ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, migration VARCHAR(255) NOT NULL, plugin_key VARCHAR(255) NOT NULL, @@ -24,9 +30,7 @@ public function up() public function down() { - $tableName = $this->worker->getPrefix() . 'migrator_migrations'; - - $query = "DROP TABLE $tableName"; + $query = "DROP TABLE $this->tableName"; $this->worker->query($query); } } From 3a303a0a4d9e81839620e282865f8ecdc429c9b7 Mon Sep 17 00:00:00 2001 From: Coen Jacobs Date: Tue, 5 Feb 2019 11:56:47 +0100 Subject: [PATCH 04/12] Make sure table is checked only once per logger instance --- src/Loggers/DatabaseLogger.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Loggers/DatabaseLogger.php b/src/Loggers/DatabaseLogger.php index 3f1396d..3bca703 100644 --- a/src/Loggers/DatabaseLogger.php +++ b/src/Loggers/DatabaseLogger.php @@ -10,6 +10,9 @@ class DatabaseLogger extends BaseLogger /** @var string */ protected $tableName; + /** @var bool */ + protected $setup = false; + public function __construct($tableName) { $this->tableName = $tableName; @@ -26,6 +29,10 @@ public function init() public function isTableSetup() { + if ($this->setup === true) { + return true; + } + $databaseName = $this->worker->getDatabaseName(); // Check if table exists before we try to query it @@ -39,6 +46,7 @@ public function isTableSetup() return false; } + $this->setup = true; return true; } From 0b9bbcb3685155dae0181d8812e8c717b47d5bbe Mon Sep 17 00:00:00 2001 From: Coen Jacobs Date: Tue, 5 Feb 2019 12:06:23 +0100 Subject: [PATCH 05/12] Flag setup being done after table is made --- src/Loggers/DatabaseLogger.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Loggers/DatabaseLogger.php b/src/Loggers/DatabaseLogger.php index 3bca703..84198b4 100644 --- a/src/Loggers/DatabaseLogger.php +++ b/src/Loggers/DatabaseLogger.php @@ -24,6 +24,8 @@ public function init() $migration = new CreateMigrationsTable($this->worker); $migration->setTableName($this->tableName); $migration->up(); + + $this->setup = true; } } From 7af608cbed7289142dc0ecf1f40ed701ef7b0117 Mon Sep 17 00:00:00 2001 From: Coen Jacobs Date: Tue, 5 Feb 2019 12:08:08 +0100 Subject: [PATCH 06/12] Table check method needs not be public --- src/Loggers/DatabaseLogger.php | 47 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/src/Loggers/DatabaseLogger.php b/src/Loggers/DatabaseLogger.php index 84198b4..88d640b 100644 --- a/src/Loggers/DatabaseLogger.php +++ b/src/Loggers/DatabaseLogger.php @@ -29,29 +29,6 @@ public function init() } } - public function isTableSetup() - { - if ($this->setup === true) { - return true; - } - - $databaseName = $this->worker->getDatabaseName(); - - // Check if table exists before we try to query it - $query = "SELECT count(*) - FROM information_schema.TABLES - WHERE (TABLE_SCHEMA = '$databaseName') AND (TABLE_NAME = '$this->tableName')"; - - $result = $this->worker->getResults($query); - - if (empty($result) || $result[0]->{"count(*)"} == 0) { - return false; - } - - $this->setup = true; - return true; - } - public function add($plugin_key, Migration $migration, $batch) { $this->init(); @@ -87,6 +64,7 @@ public function getLoggedMigrations($plugin_keys) foreach ($results as $result) { $migrations[] = $result->migration; } + return $migrations; } @@ -103,4 +81,27 @@ public function getHighestBatchNumber() return array_pop($results)->batch; } + + protected function isTableSetup() + { + if ($this->setup === true) { + return true; + } + + $databaseName = $this->worker->getDatabaseName(); + + // Check if table exists before we try to query it + $query = "SELECT count(*) + FROM information_schema.TABLES + WHERE (TABLE_SCHEMA = '$databaseName') AND (TABLE_NAME = '$this->tableName')"; + + $result = $this->worker->getResults($query); + + if (empty($result) || $result[0]->{"count(*)"} == 0) { + return false; + } + + $this->setup = true; + return true; + } } From bc33654e278f142297cad2abb5c77a662e424e4e Mon Sep 17 00:00:00 2001 From: Coen Jacobs Date: Tue, 5 Feb 2019 12:20:52 +0100 Subject: [PATCH 07/12] Tests around core migrations aren't needed anymore --- tests/Unit/HandlerTest.php | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/tests/Unit/HandlerTest.php b/tests/Unit/HandlerTest.php index d98895a..e7bdf9a 100644 --- a/tests/Unit/HandlerTest.php +++ b/tests/Unit/HandlerTest.php @@ -6,7 +6,6 @@ use CoenJacobs\Migrator\Contracts\Logger; use CoenJacobs\Migrator\Contracts\Worker; use CoenJacobs\Migrator\Contracts\Migration; -use CoenJacobs\Migrator\Exceptions\ReservedNameException; use PHPUnit_Framework_TestCase; class HandlerTest extends PHPUnit_Framework_TestCase @@ -69,31 +68,4 @@ public function testHandlerDoesntCallDifferentPluginMigrations() $handler->add('another-key', $this->migration); $handler->up('test'); } - - /** @test */ - public function testHandlerDoesntAcceptMigrationsWithReservedName() - { - $this->expectException(ReservedNameException::class); - - $handler = new Handler($this->worker, $this->logger); - $handler->add('core', $this->migration); - } - - /** @test */ - public function testHandlerDoesntUpMigrationsWithReservedName() - { - $this->expectException(ReservedNameException::class); - - $handler = new Handler($this->worker, $this->logger); - $handler->up('core', $this->migration); - } - - /** @test */ - public function testHandlerDoesntDownMigrationsWithReservedName() - { - $this->expectException(ReservedNameException::class); - - $handler = new Handler($this->worker, $this->logger); - $handler->down('core', $this->migration); - } } From a2b7cac4b33338e23d601e7ddacf80845ee6dfa6 Mon Sep 17 00:00:00 2001 From: Coen Jacobs Date: Tue, 5 Feb 2019 12:30:46 +0100 Subject: [PATCH 08/12] Updated documentation with paired logger table/migration --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b6fde00..1bc02c3 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,9 @@ Worker classes are the classes responsible for actually performing the queries y ## Loggers -Loggers take care of registering the migrations that have been run already. This is to ensure that no migrations are being run more than once. By default, there is a database based Logger available, in the `CoenJacobs\Migrator\Loggers\DatabaseLogger` class. This class actually uses the aforementioned `$wpdb` based Worker, in order to log the migration data into a specific database table. You can provide your own implementation of the Logger class, as long as they implement the `CoenJacobs\Migrator\Contracts\Logger` interface. +Loggers take care of registering the migrations that have been run already. This is to ensure that no migrations are being run more than once. By default, there is a database based Logger available, in the `CoenJacobs\Migrator\Loggers\DatabaseLogger` class. This class actually uses the aforementioned `$wpdb` based Worker, in order to log the migration data into a specific database table. This database table is being created, using the table name you've provided as the first contructor argument. + +You can provide your own implementation of the Logger class, as long as they implement the `CoenJacobs\Migrator\Contracts\Logger` interface. ## Migration structure @@ -77,7 +79,8 @@ use CoenJacobs\Migrator\Loggers\DatabaseLogger; use CoenJacobs\Migrator\Workers\WpdbWorker; $worker = new WpdbWorker(); -$migrator = new Handler($worker, new DatabaseLogger()); +$logger = new DatabaseLogger('migrations_table_name'); +$handler = new Handler($worker, $logger); ``` After that, the Handler is ready to accept new migrations to be added, before they can be run. You pass the class as a string of the class name, where the class itself again implements the `CoenJacobs\Migrator\Contracts\Migration` interface: From 6e20cd2ac9b43a389224ebf572725c5b6010d132 Mon Sep 17 00:00:00 2001 From: Coen Jacobs Date: Tue, 5 Feb 2019 12:38:44 +0100 Subject: [PATCH 09/12] Is the path in phpunit.xml case sensitive? Travis doesn't run. --- phpunit.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit.xml b/phpunit.xml index e6b6f40..1915aca 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -9,7 +9,7 @@ > - ./tests/unit/ + ./tests/Unit/ From b1c3817df391f6cf56ebd2abbc2fe500ee4f76e7 Mon Sep 17 00:00:00 2001 From: Coen Jacobs Date: Tue, 5 Feb 2019 14:51:56 +0100 Subject: [PATCH 10/12] Somewhat dirty test that validates handler works --- tests/Unit/HandlerTest.php | 103 ++++++++++++++++++++----------------- 1 file changed, 57 insertions(+), 46 deletions(-) diff --git a/tests/Unit/HandlerTest.php b/tests/Unit/HandlerTest.php index e7bdf9a..3901e7b 100644 --- a/tests/Unit/HandlerTest.php +++ b/tests/Unit/HandlerTest.php @@ -2,70 +2,81 @@ namespace CoenJacobs\MigratorTests\Unit; +use CoenJacobs\Migrator\Contracts\Migration as MigrationContract; use CoenJacobs\Migrator\Handler; -use CoenJacobs\Migrator\Contracts\Logger; -use CoenJacobs\Migrator\Contracts\Worker; -use CoenJacobs\Migrator\Contracts\Migration; +use CoenJacobs\Migrator\Loggers\BaseLogger; +use CoenJacobs\Migrator\Migrations\BaseMigration; +use CoenJacobs\Migrator\Workers\BaseWorker; use PHPUnit_Framework_TestCase; class HandlerTest extends PHPUnit_Framework_TestCase { - private $worker; - private $logger; - private $downLogger; - private $migration; - - public function setUp() + /** @test */ + public function callsUpOnMigration() { - $this->worker = $this->getMockBuilder(Worker::class) - ->getMock(); - - $this->logger = $this->getMockBuilder(Logger::class) - ->getMock(); - $this->logger->expects($this->any()) - ->method('getLoggedMigrations') - ->will($this->returnValue([])); + $this->expectExceptionMessage('up method called'); - $this->downLogger = $this->getMockBuilder(Logger::class) - ->getMock(); - $this->downLogger->expects($this->any()) - ->method('getLoggedMigrations') - ->will($this->returnValue(['test-migration'])); - - $this->migration = $this->getMockBuilder(Migration::class) - ->getMock(); - $this->migration->expects($this->any()) - ->method('getId') - ->will($this->returnValue('test-migration')); + $handler = new Handler(new Worker(), new Logger()); + $handler->add('test-up-migrations', Migration::class); + $handler->up('test-up-migrations'); } /** @test */ - public function testHandlerCallsUpOnMigration() + public function callsDownOnMigration() { - $this->migration->expects($this->once())->method('up'); + $this->expectExceptionMessage('down method called'); - $handler = new Handler($this->worker, $this->logger); - $handler->add('test', $this->migration); - $handler->up('test'); + $handler = new Handler(new Worker(), new Logger()); + $handler->add('test-down-migrations', Migration::class); + $handler->down('test-down-migrations'); } +} - /** @test */ - public function testHandlerCallsDownOnMigration() +class Logger extends BaseLogger +{ + public function add($plugin_key, MigrationContract $migration, $batch) { } + public function remove($plugin_key, MigrationContract $migration) { } + + public function getLoggedMigrations($plugin_keys) { - $this->migration->expects($this->once())->method('down'); + if (in_array('test-down-migrations', $plugin_keys)) { + return ['test-migration']; + } else { + return []; + } + } + + public function getHighestBatchNumber() { } +} - $handler = new Handler($this->worker, $this->downLogger); - $handler->add('test', $this->migration); - $handler->down('test'); +class Worker extends BaseWorker +{ + public function getPrefix() { } + public function getDatabaseName() { } + public function query($query) { } + public function getResults($query) { } +} + +class Migration extends BaseMigration +{ + public static function id() + { + return 'test-migration'; } - /** @test */ - public function testHandlerDoesntCallDifferentPluginMigrations() + /** + * @throws \Exception + */ + public function up() { - $this->migration->expects($this->never())->method($this->anything()); + throw new \Exception('up method called'); + } - $handler = new Handler($this->worker, $this->logger); - $handler->add('another-key', $this->migration); - $handler->up('test'); + /** + * @throws \Exception + */ + public function down() + { + throw new \Exception('down method called'); } -} +} \ No newline at end of file From 03e04feef236c168f2620e0dcee9cc3dc242d74f Mon Sep 17 00:00:00 2001 From: Coen Jacobs Date: Tue, 5 Feb 2019 14:58:47 +0100 Subject: [PATCH 11/12] Use the autoloader as bootstrap for now, so files are loaded --- phpunit.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/phpunit.xml b/phpunit.xml index 1915aca..6bf6152 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,6 +1,7 @@ Date: Tue, 5 Feb 2019 15:16:41 +0100 Subject: [PATCH 12/12] Use modern PHPUnit framework test class (and pray for alias) --- tests/Unit/HandlerTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Unit/HandlerTest.php b/tests/Unit/HandlerTest.php index 3901e7b..6389696 100644 --- a/tests/Unit/HandlerTest.php +++ b/tests/Unit/HandlerTest.php @@ -7,9 +7,9 @@ use CoenJacobs\Migrator\Loggers\BaseLogger; use CoenJacobs\Migrator\Migrations\BaseMigration; use CoenJacobs\Migrator\Workers\BaseWorker; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; -class HandlerTest extends PHPUnit_Framework_TestCase +class HandlerTest extends TestCase { /** @test */ public function callsUpOnMigration()