1
0
mirror of https://github.com/danog/amp.git synced 2024-11-27 04:24:42 +01:00
amp/test/LoopStateTest.php
2017-03-10 21:31:57 +01:00

41 lines
851 B
PHP

<?php
namespace Amp\Test;
use Amp\Loop\Driver;
class LoopStateTest extends \PHPUnit_Framework_TestCase {
/** @var Driver */
private $loop;
protected function setUp() {
$this->loop = $this->getMockForAbstractClass(Driver::class);
}
/** @test */
public function defaultsToNull() {
$this->assertNull($this->loop->getState("foobar"));
}
/**
* @test
* @dataProvider provideValues
*/
public function getsPreviouslySetValue($value) {
$this->loop->setState("foobar", $value);
$this->assertSame($value, $this->loop->getState("foobar"));
}
public function provideValues() {
return [
["string"],
[42],
[1.001],
[true],
[false],
[null],
[new \StdClass],
];
}
}