From 130be14d572fd13ff9f2f0cf5d9821d857e7ab1d Mon Sep 17 00:00:00 2001 From: Khoubza Younes Date: Sun, 6 Dec 2020 19:33:03 +0100 Subject: [PATCH] fix all tests --- FlasherNotyfServiceProvider.php | 4 ++-- ServiceProvider/Providers/Laravel.php | 2 +- ServiceProvider/Providers/Laravel4.php | 2 +- ServiceProvider/Providers/Lumen.php | 2 +- ...php => FlasherNotyfServiceProviderTest.php} | 18 +++++++++--------- Tests/TestCase.php | 13 ++++++------- phpunit.xml.dist | 2 +- 7 files changed, 21 insertions(+), 22 deletions(-) rename Tests/{NotifyNotyfServiceProviderTest.php => FlasherNotyfServiceProviderTest.php} (61%) diff --git a/FlasherNotyfServiceProvider.php b/FlasherNotyfServiceProvider.php index 1de9c0b0..0d9a0fb8 100644 --- a/FlasherNotyfServiceProvider.php +++ b/FlasherNotyfServiceProvider.php @@ -2,7 +2,7 @@ namespace Flasher\Notyf\Laravel; -use Illuminate\Contracts\Support\DeferrableProvider; +use Illuminate\Container\Container; use Illuminate\Support\ServiceProvider; use Flasher\Notyf\Laravel\ServiceProvider\ServiceProviderManager; @@ -37,7 +37,7 @@ class FlasherNotyfServiceProvider extends ServiceProvider } /** - * @return \Illuminate\Container\Container + * @return Container */ public function getApplication() { diff --git a/ServiceProvider/Providers/Laravel.php b/ServiceProvider/Providers/Laravel.php index 9bcc658f..cc112cf4 100644 --- a/ServiceProvider/Providers/Laravel.php +++ b/ServiceProvider/Providers/Laravel.php @@ -26,7 +26,7 @@ class Laravel implements ServiceProviderInterface public function publishConfig(FlasherNotyfServiceProvider $provider) { - $source = realpath($raw = __DIR__.'/../../../resources/config/config.php') ?: $raw; + $source = realpath($raw = __DIR__.'/../../Resources/config/config.php') ?: $raw; $provider->publishes(array($source => config_path('flasher_notyf.php')), 'config'); diff --git a/ServiceProvider/Providers/Laravel4.php b/ServiceProvider/Providers/Laravel4.php index 5288ac02..c9a9b46c 100644 --- a/ServiceProvider/Providers/Laravel4.php +++ b/ServiceProvider/Providers/Laravel4.php @@ -14,7 +14,7 @@ final class Laravel4 extends Laravel public function publishConfig(FlasherNotyfServiceProvider $provider) { - $provider->package('php-flasher/flasher-laravel-notyf', 'flasher_notyf', __DIR__.'/../../../resources'); + $provider->package('php-flasher/flasher-laravel-notyf', 'flasher_notyf', __DIR__.'/../../Resources'); } public function mergeConfigFromNotyf() diff --git a/ServiceProvider/Providers/Lumen.php b/ServiceProvider/Providers/Lumen.php index 877edd27..7d1d37f0 100644 --- a/ServiceProvider/Providers/Lumen.php +++ b/ServiceProvider/Providers/Lumen.php @@ -14,7 +14,7 @@ final class Lumen extends Laravel public function publishConfig(FlasherNotyfServiceProvider $provider) { - $source = realpath($raw = __DIR__.'/../../../resources/config/config.php') ?: $raw; + $source = realpath($raw = __DIR__.'/../../Resources/config/config.php') ?: $raw; $this->app->configure('flasher_notyf'); diff --git a/Tests/NotifyNotyfServiceProviderTest.php b/Tests/FlasherNotyfServiceProviderTest.php similarity index 61% rename from Tests/NotifyNotyfServiceProviderTest.php rename to Tests/FlasherNotyfServiceProviderTest.php index b6aadaf1..76acdd0c 100644 --- a/Tests/NotifyNotyfServiceProviderTest.php +++ b/Tests/FlasherNotyfServiceProviderTest.php @@ -2,37 +2,37 @@ namespace Flasher\Notyf\Laravel\Tests; -final class NotifyNotyfServiceProviderTest extends TestCase +final class FlasherNotyfServiceProviderTest extends TestCase { public function testContainerContainNotifyServices() { - $this->assertTrue($this->app->bound('flasher.factory')); + $this->assertTrue($this->app->bound('flasher')); $this->assertTrue($this->app->bound('flasher.factory.notyf')); } public function testNotifyFactoryIsAddedToExtensionsArray() { - $manager = $this->app->make('flasher.factory'); + $flasher = $this->app->make('flasher'); - $reflection = new \ReflectionClass($manager); + $reflection = new \ReflectionClass($flasher); $property = $reflection->getProperty('drivers'); $property->setAccessible(true); - $extensions = $property->getValue($manager); + $extensions = $property->getValue($flasher); $this->assertCount(1, $extensions); - $this->assertInstanceOf('Flasher\Prime\FlasherInterface', $extensions['notyf']); + $this->assertInstanceOf('Flasher\Prime\Factory\FlasherFactoryInterface', $extensions[0]); } public function testConfigNotyfInjectedInGlobalNotifyConfig() { - $manager = $this->app->make('flasher.factory'); + $flasher = $this->app->make('flasher'); - $reflection = new \ReflectionClass($manager); + $reflection = new \ReflectionClass($flasher); $property = $reflection->getProperty('config'); $property->setAccessible(true); - $config = $property->getValue($manager); + $config = $property->getValue($flasher); $this->assertArrayHasKey('notyf', $config->get('adapters')); diff --git a/Tests/TestCase.php b/Tests/TestCase.php index 785c70de..4d616883 100644 --- a/Tests/TestCase.php +++ b/Tests/TestCase.php @@ -9,31 +9,30 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Facade; use Orchestra\Testbench\TestCase as Orchestra; -final class TestCase extends Orchestra +class TestCase extends Orchestra { /** - * @param \Illuminate\Foundation\Application $app + * @param Application $app * * @return array */ protected function getPackageProviders($app = null) { return array( - 'Flasher\LaravelFlasher\PrimeServiceProvider', - 'Flasher\Notyf\LaravelFlasher\PrimeNotyfServiceProvider', + 'Flasher\Laravel\FlasherServiceProvider', + '\Flasher\Notyf\Laravel\FlasherNotyfServiceProvider', ); } /** - * @param \Illuminate\Foundation\Application $app + * @param Application $app */ protected function getEnvironmentSetUp($app) { $separator = $this->isLaravel4() ? '::config' : ''; $app['config']->set('session'.$separator.'.driver', 'array'); - $app['config']->set('notify'.$separator.'.stamps_middlewares', array()); - $app['config']->set('notify'.$separator.'.adapters', array( + $app['config']->set('flasher'.$separator.'.adapters', array( 'notyf' => array('scripts' => array('jquery.js'), 'styles' => array('styles.css'), 'options' => array()), )); } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 2621c486..1e1af721 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -16,7 +16,7 @@ - src/ + ./