mirror of
https://github.com/danog/amp.git
synced 2024-12-04 10:28:01 +01:00
45 lines
920 B
PHP
45 lines
920 B
PHP
<?php
|
|
|
|
namespace Interop\Async\Loop;
|
|
|
|
class RegistryTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
private $registry;
|
|
|
|
protected function setUp()
|
|
{
|
|
$this->registry = $this->getMockForAbstractClass(Driver::class);
|
|
}
|
|
|
|
/** @test */
|
|
public function defaultsToNull()
|
|
{
|
|
$this->assertNull($this->registry->fetchState("foobar"));
|
|
}
|
|
|
|
/**
|
|
* @test
|
|
* @dataProvider provideValues
|
|
*/
|
|
public function fetchesStoredValue($value)
|
|
{
|
|
$this->assertNull($this->registry->fetchState("foobar"));
|
|
$this->registry->storeState("foobar", $value);
|
|
|
|
$this->assertSame($value, $this->registry->fetchState("foobar"));
|
|
}
|
|
|
|
public function provideValues()
|
|
{
|
|
return [
|
|
["string"],
|
|
[42],
|
|
[1.001],
|
|
[true],
|
|
[false],
|
|
[null],
|
|
[new \StdClass],
|
|
];
|
|
}
|
|
}
|