From 63cb2e3d7465415626b499ea246f9ce175989d01 Mon Sep 17 00:00:00 2001 From: Octavian Paralescu Date: Wed, 14 Mar 2018 21:51:08 +0200 Subject: [PATCH 1/2] Fixes tests so the build can pass --- composer.json | 2 +- .../MigrationsGeneratorServiceProvider.php | 14 +++++----- ...MigrationsGeneratorServiceProviderTest.php | 26 ++++++++----------- .../MigrationsGeneratorTest.php | 6 ++--- 4 files changed, 23 insertions(+), 25 deletions(-) diff --git a/composer.json b/composer.json index 789fd13..b5d62ac 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ }, "require-dev": { "phpunit/phpunit": ">=4.0.0", - "mockery/mockery": ">=0.9.0", + "mockery/mockery": ">=1.0.0", "illuminate/cache": ">=4.1.0", "illuminate/console": ">=4.1.0" }, diff --git a/src/Xethron/MigrationsGenerator/MigrationsGeneratorServiceProvider.php b/src/Xethron/MigrationsGenerator/MigrationsGeneratorServiceProvider.php index 12c1b32..5e0ab31 100644 --- a/src/Xethron/MigrationsGenerator/MigrationsGeneratorServiceProvider.php +++ b/src/Xethron/MigrationsGenerator/MigrationsGeneratorServiceProvider.php @@ -29,13 +29,15 @@ function($app) { ); }); - $this->commands('migration.generate'); - // Bind the Repository Interface to $app['migrations.repository'] - $this->app->bind('Illuminate\Database\Migrations\MigrationRepositoryInterface', function($app) { - return $app['migration.repository']; - }); - } + $this->commands('migration.generate'); + + // Bind the Repository Interface to $app['migrations.repository'] + $this->app->bind('Illuminate\Database\Migrations\MigrationRepositoryInterface', function($app) { + return $app['migration.repository']; + }); + + } /** * Bootstrap the application events. diff --git a/tests/Xethron/MigrationsGenerator/MigrationsGeneratorServiceProviderTest.php b/tests/Xethron/MigrationsGenerator/MigrationsGeneratorServiceProviderTest.php index b212359..8bb3d63 100644 --- a/tests/Xethron/MigrationsGenerator/MigrationsGeneratorServiceProviderTest.php +++ b/tests/Xethron/MigrationsGenerator/MigrationsGeneratorServiceProviderTest.php @@ -1,9 +1,10 @@ shouldReceive('bind') - ->atLeast()->once() - ->with( - 'migration.generate', - Mockery::any() - ); - + $app_mock - ->shouldReceive('share') + ->shouldReceive('singleton') ->atLeast()->once() - ->with( + ->with('migration.generate', Mockery::on(function($callback) { $mock = $this->get_app_mock(); @@ -99,7 +92,10 @@ public function registers_migrations_generator() $service_provider_mock ->shouldReceive('commands') - ->atLeast()->once(); + ->atLeast()->once() + ->with( + 'migration.generate' + ); $service_provider_mock->register(); } @@ -165,7 +161,7 @@ protected function get_migration_repository_mock() protected function get_repository_mock() { - return Mockery::mock('Illuminate\Config\Repository') + return Mockery::mock(Repository::class) ->shouldAllowMockingProtectedMethods() ->makePartial(); } diff --git a/tests/Xethron/MigrationsGenerator/MigrationsGeneratorTest.php b/tests/Xethron/MigrationsGenerator/MigrationsGeneratorTest.php index 85c9726..aece9e7 100644 --- a/tests/Xethron/MigrationsGenerator/MigrationsGeneratorTest.php +++ b/tests/Xethron/MigrationsGenerator/MigrationsGeneratorTest.php @@ -1,9 +1,9 @@ markTestSkipped('No tests implemented yet.'); } } From ee71bccf319cabbfe179e4675bca498ee2b58f54 Mon Sep 17 00:00:00 2001 From: Octavian Paralescu Date: Wed, 14 Mar 2018 22:01:24 +0200 Subject: [PATCH 2/2] Adds support for PHP 5.5 --- composer.json | 2 +- .../MigrationsGeneratorServiceProviderTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index b5d62ac..034c03d 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ }, "require-dev": { "phpunit/phpunit": ">=4.0.0", - "mockery/mockery": ">=1.0.0", + "mockery/mockery": "0.9.0", "illuminate/cache": ">=4.1.0", "illuminate/console": ">=4.1.0" }, diff --git a/tests/Xethron/MigrationsGenerator/MigrationsGeneratorServiceProviderTest.php b/tests/Xethron/MigrationsGenerator/MigrationsGeneratorServiceProviderTest.php index 8bb3d63..197f354 100644 --- a/tests/Xethron/MigrationsGenerator/MigrationsGeneratorServiceProviderTest.php +++ b/tests/Xethron/MigrationsGenerator/MigrationsGeneratorServiceProviderTest.php @@ -161,7 +161,7 @@ protected function get_migration_repository_mock() protected function get_repository_mock() { - return Mockery::mock(Repository::class) + return Mockery::mock('\Illuminate\Contracts\Config\Repository') ->shouldAllowMockingProtectedMethods() ->makePartial(); }