Files
php-flasher/tests/Laravel/FlasherServiceProviderTest.php
T
2021-10-03 21:39:04 +01:00

46 lines
1.9 KiB
PHP

<?php
namespace Flasher\Tests\Laravel;
use Illuminate\View\Compilers\BladeCompiler;
final class FlasherServiceProviderTest extends TestCase
{
public function testNotifyServiceExists()
{
$this->assertInstanceOf('Flasher\Laravel\Config\Config', $this->app->make('flasher.config'));
$this->assertInstanceOf('Flasher\Prime\Flasher', $this->app->make('flasher'));
$this->assertInstanceOf('Flasher\Prime\Response\ResponseManager', $this->app->make('flasher.response_manager'));
$this->assertInstanceOf(
'Flasher\Prime\Response\Resource\ResourceManager',
$this->app->make('flasher.resource_manager')
);
$this->assertInstanceOf('Flasher\Laravel\Storage\Storage', $this->app->make('flasher.storage'));
$this->assertInstanceOf('Flasher\Prime\Storage\StorageManager', $this->app->make('flasher.storage_manager'));
$this->assertInstanceOf(
'Flasher\Prime\EventDispatcher\EventDispatcher',
$this->app->make('flasher.event_dispatcher')
);
$this->assertInstanceOf('Flasher\Prime\Filter\Filter', $this->app->make('flasher.filter'));
}
public function testBladeDirective()
{
/** @var BladeCompiler $blade */
$blade = $this->app->make('view')->getEngineResolver()->resolve('blade')->getCompiler();
$this->assertEquals(
"<?php echo app('flasher.response_manager')->render(); ?>",
$blade->compileString('@flasher_render()')
);
$this->assertEquals(
"<?php echo app('flasher.response_manager')->render(array()); ?>",
$blade->compileString('@flasher_render(array())')
);
$this->assertEquals(
"<?php echo app('flasher.response_manager')->render(array(\"priority\" => array(\"min\" => 4, \"max\" => 5))); ?>",
$blade->compileString('@flasher_render(array("priority" => array("min" => 4, "max" => 5)))')
);
}
}