mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-03-31 15:07:47 +01:00
42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Flasher\Tests\Laravel\Component;
|
|
|
|
use Flasher\Laravel\Component\FlasherComponent;
|
|
use Flasher\Prime\FlasherInterface;
|
|
use Illuminate\Container\Container;
|
|
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
/**
|
|
* FlasherComponentTest tests the render method in the FlasherComponent class.
|
|
*/
|
|
final class FlasherComponentTest extends TestCase
|
|
{
|
|
use MockeryPHPUnitIntegration;
|
|
|
|
private FlasherComponent $flasherComponent;
|
|
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
|
|
$flasherServiceMock = \Mockery::mock(FlasherInterface::class);
|
|
$flasherServiceMock->allows('render')
|
|
->andReturns('Your expected result');
|
|
|
|
Container::getInstance()->instance('flasher', $flasherServiceMock);
|
|
|
|
$this->flasherComponent = new FlasherComponent('{"key":"value"}', '{"key":"value"}');
|
|
}
|
|
|
|
public function testRender(): void
|
|
{
|
|
$expectedResult = 'Your expected result';
|
|
$actualResult = $this->flasherComponent->render();
|
|
$this->assertSame($expectedResult, $actualResult);
|
|
}
|
|
}
|