You've already forked php-flasher
mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-04-05 12:32:55 +01:00
64 lines
1.6 KiB
PHP
64 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Flasher\Tests\Prime\Stamp;
|
|
|
|
use Flasher\Prime\Stamp\ContextStamp;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class ContextStampTest extends TestCase
|
|
{
|
|
public function testGetContextReturnsTheCorrectArray(): void
|
|
{
|
|
$contextArray = ['key1' => 'value1', 'key2' => 'value2'];
|
|
|
|
$contextStamp = new ContextStamp($contextArray);
|
|
|
|
$this->assertSame(
|
|
$contextArray,
|
|
$contextStamp->getContext(),
|
|
'The getContext method did not return the expected array.'
|
|
);
|
|
}
|
|
|
|
public function testGetContextWithEmptyArray(): void
|
|
{
|
|
$contextArray = [];
|
|
|
|
$contextStamp = new ContextStamp($contextArray);
|
|
|
|
$this->assertSame(
|
|
$contextArray,
|
|
$contextStamp->getContext(),
|
|
'The getContext method did not return an empty array with empty context.'
|
|
);
|
|
}
|
|
|
|
public function testToArrayReturnsContextInArray(): void
|
|
{
|
|
$contextArray = ['key1' => 'value1', 'key2' => 'value2'];
|
|
|
|
$contextStamp = new ContextStamp($contextArray);
|
|
|
|
$this->assertSame(
|
|
['context' => $contextArray],
|
|
$contextStamp->toArray(),
|
|
'The toArray method did not return the expected array.'
|
|
);
|
|
}
|
|
|
|
public function testToArrayWithEmptyArray(): void
|
|
{
|
|
$contextArray = [];
|
|
|
|
$contextStamp = new ContextStamp($contextArray);
|
|
|
|
$this->assertSame(
|
|
['context' => $contextArray],
|
|
$contextStamp->toArray(),
|
|
'The toArray method did not return an array with empty context as expected.'
|
|
);
|
|
}
|
|
}
|