mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-03-31 15:07:47 +01:00
fix test for flasher laravel
This commit is contained in:
@@ -6,12 +6,4 @@ return array(
|
||||
'scripts' => array(
|
||||
'/vendor/php-flasher/flasher/assets/js/flasher.js'
|
||||
),
|
||||
|
||||
'styles' => array(
|
||||
|
||||
),
|
||||
|
||||
'adapters' => array(
|
||||
|
||||
),
|
||||
);
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
+5
-3
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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("<?php echo app('flasher.presenter.html')->render(); ?>", $blade->compileString('@notify_render'));
|
||||
$this->assertEquals("<?php echo app('flasher.presenter.html')->render(); ?>", $blade->compileString('@flasher_render'));
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ class TestCase extends Orchestra
|
||||
protected function getPackageProviders($app = null)
|
||||
{
|
||||
return array(
|
||||
'Flasher\LaravelFlasher\PrimeServiceProvider',
|
||||
'Flasher\Laravel\FlasherServiceProvider',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">src/</directory>
|
||||
<directory suffix=".php">./</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
||||
|
||||
Reference in New Issue
Block a user