From fd52411349e06890028512c1ecc6808e851ed21c Mon Sep 17 00:00:00 2001 From: Khoubza Younes Date: Sun, 6 Dec 2020 19:11:13 +0100 Subject: [PATCH] fix test for flasher laravel --- Resources/config/config.php | 8 -------- ServiceProvider/Providers/Laravel.php | 4 ++-- ServiceProvider/Providers/Laravel4.php | 2 +- ServiceProvider/Providers/Lumen.php | 6 +++--- ServiceProvider/ServiceProviderManager.php | 1 - Storage/Storage.php | 8 +++++--- Tests/Config/ConfigTest.php | 2 +- ...iderTest.php => FlasherServiceProviderTest.php} | 14 +++++++------- Tests/Storage/StorageTest.php | 4 ++-- Tests/TestCase.php | 2 +- phpunit.xml.dist | 2 +- 11 files changed, 23 insertions(+), 30 deletions(-) rename Tests/{NotifyServiceProviderTest.php => FlasherServiceProviderTest.php} (61%) diff --git a/Resources/config/config.php b/Resources/config/config.php index 31eff3ed..618ceeae 100644 --- a/Resources/config/config.php +++ b/Resources/config/config.php @@ -6,12 +6,4 @@ return array( 'scripts' => array( '/vendor/php-flasher/flasher/assets/js/flasher.js' ), - - 'styles' => array( - - ), - - 'adapters' => array( - - ), ); diff --git a/ServiceProvider/Providers/Laravel.php b/ServiceProvider/Providers/Laravel.php index c8829687..58baab8b 100644 --- a/ServiceProvider/Providers/Laravel.php +++ b/ServiceProvider/Providers/Laravel.php @@ -44,7 +44,7 @@ class Laravel implements ServiceProviderInterface public function publishConfig(FlasherServiceProvider $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.php')), 'config'); @@ -53,7 +53,7 @@ class Laravel implements ServiceProviderInterface public function publishAssets(FlasherServiceProvider $provider) { - $provider->publishes(array(__DIR__.'/../../../public' => public_path('vendor/php-flasher/flasher/assets/js')), 'public'); + $provider->publishes(array(__DIR__.'/../../public' => public_path('vendor/php-flasher/flasher/assets/js')), 'public'); } public function registerServices() diff --git a/ServiceProvider/Providers/Laravel4.php b/ServiceProvider/Providers/Laravel4.php index 50a2f2b3..a97425ff 100644 --- a/ServiceProvider/Providers/Laravel4.php +++ b/ServiceProvider/Providers/Laravel4.php @@ -16,7 +16,7 @@ final class Laravel4 extends Laravel public function publishConfig(FlasherServiceProvider $provider) { - $provider->package('php-flasher/flasher-laravel', 'notify', __DIR__.'/../../../resources'); + $provider->package('php-flasher/flasher-laravel', 'notify', __DIR__.'/../../resources'); } public function publishAssets(FlasherServiceProvider $provider) diff --git a/ServiceProvider/Providers/Lumen.php b/ServiceProvider/Providers/Lumen.php index b36dbfd1..3c31433e 100644 --- a/ServiceProvider/Providers/Lumen.php +++ b/ServiceProvider/Providers/Lumen.php @@ -2,8 +2,8 @@ namespace Flasher\Laravel\ServiceProvider\Providers; +use Flasher\Laravel\FlasherServiceProvider; use Laravel\Lumen\Application; -use Flasher\LaravelFlasher\PrimeServiceProvider; final class Lumen extends Laravel { @@ -12,9 +12,9 @@ final class Lumen extends Laravel return $this->app instanceof Application; } - public function publishConfig(NotifyServiceProvider $provider) + public function publishConfig(FlasherServiceProvider $provider) { - $source = realpath($raw = __DIR__.'/../../../resources/config/config.php') ?: $raw; + $source = realpath($raw = __DIR__.'/../../../Resources/config/config.php') ?: $raw; $this->app->configure('notify'); diff --git a/ServiceProvider/ServiceProviderManager.php b/ServiceProvider/ServiceProviderManager.php index cfb2a43e..227deb9f 100644 --- a/ServiceProvider/ServiceProviderManager.php +++ b/ServiceProvider/ServiceProviderManager.php @@ -3,7 +3,6 @@ namespace Flasher\Laravel\ServiceProvider; use Flasher\Laravel\FlasherServiceProvider; -use Flasher\LaravelFlasher\PrimeServiceProvider; use Flasher\Laravel\ServiceProvider\Providers\ServiceProviderInterface; final class ServiceProviderManager diff --git a/Storage/Storage.php b/Storage/Storage.php index b1557b3d..74f07cd0 100644 --- a/Storage/Storage.php +++ b/Storage/Storage.php @@ -5,18 +5,20 @@ namespace Flasher\Laravel\Storage; use Flasher\Prime\Envelope; use Flasher\Prime\Stamp\UuidStamp; use Flasher\Prime\Storage\StorageInterface; +use Illuminate\Session\SessionManager; +use Illuminate\Session\Store; final class Storage implements StorageInterface { const ENVELOPES_NAMESPACE = 'flasher::envelopes'; /** - * @var \Illuminate\Session\SessionManager|\Illuminate\Session\Store + * @var SessionManager|Store */ private $session; /** - * @param \Illuminate\Session\SessionManager|\Illuminate\Session\Store $session + * @param SessionManager|Store $session */ public function __construct($session) { @@ -26,7 +28,7 @@ final class Storage implements StorageInterface /** * @inheritDoc */ - public function get() + public function all() { return $this->session->get(self::ENVELOPES_NAMESPACE, array()); } diff --git a/Tests/Config/ConfigTest.php b/Tests/Config/ConfigTest.php index 4fc07f55..a947f072 100644 --- a/Tests/Config/ConfigTest.php +++ b/Tests/Config/ConfigTest.php @@ -8,7 +8,7 @@ use Flasher\Laravel\Tests\TestCase; final class ConfigTest extends TestCase { - public function test_simple_config() + public function testSimpleConfig() { $separator = $this->isLaravel4() ? '::' : '.'; $config = new Config($this->app->make('config'), $separator); diff --git a/Tests/NotifyServiceProviderTest.php b/Tests/FlasherServiceProviderTest.php similarity index 61% rename from Tests/NotifyServiceProviderTest.php rename to Tests/FlasherServiceProviderTest.php index 2e551678..8ffc0c66 100644 --- a/Tests/NotifyServiceProviderTest.php +++ b/Tests/FlasherServiceProviderTest.php @@ -4,16 +4,16 @@ namespace Flasher\Laravel\Tests; use Illuminate\View\Compilers\BladeCompiler; -class NotifyServiceProviderTest extends TestCase +final class FlasherServiceProviderTest extends TestCase { - public function test_notify_service_exists() + public function testNotifyServiceExists() { - $this->assertTrue($this->app->bound('flasher.factory')); + $this->assertTrue($this->app->bound('flasher')); } - public function test_notify_manager_get_config() + public function testNotifyManagerGetConfig() { - $notify = $this->app->make('flasher.factory'); + $notify = $this->app->make('flasher'); $reflection = new \ReflectionClass(get_class($notify)); $config = $reflection->getProperty('config'); @@ -22,11 +22,11 @@ class NotifyServiceProviderTest extends TestCase $this->assertInstanceOf('Flasher\Prime\Config\ConfigInterface', $config->getValue($notify)); } - public function test_blade_directive() + public function testBladeDirective() { /** @var BladeCompiler $blade */ $blade = $this->app->make('view')->getEngineResolver()->resolve('blade')->getCompiler(); - $this->assertEquals("render(); ?>", $blade->compileString('@notify_render')); + $this->assertEquals("render(); ?>", $blade->compileString('@flasher_render')); } } diff --git a/Tests/Storage/StorageTest.php b/Tests/Storage/StorageTest.php index 845506ec..0c56ecaf 100644 --- a/Tests/Storage/StorageTest.php +++ b/Tests/Storage/StorageTest.php @@ -9,13 +9,13 @@ use Flasher\Prime\Notification\Notification; final class StorageTest extends TestCase { - public function test_simple() + public function testSimple() { $session = new Storage($this->app->make('session')); $envelope = new Envelope(new Notification('success', 'message')); $session->add($envelope); - $this->assertEquals(array($envelope), $session->get()); + $this->assertEquals(array($envelope), $session->all()); } } diff --git a/Tests/TestCase.php b/Tests/TestCase.php index fc9720b0..6b395bf6 100644 --- a/Tests/TestCase.php +++ b/Tests/TestCase.php @@ -14,7 +14,7 @@ class TestCase extends Orchestra protected function getPackageProviders($app = null) { return array( - 'Flasher\LaravelFlasher\PrimeServiceProvider', + 'Flasher\Laravel\FlasherServiceProvider', ); } 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/ + ./