public function testReadWrite() { $ch = fopen('testwrapper://', 'rw'); TestStreamWrapper::addRead("read line\n"); fwrite($ch, "written line\n"); $line = fgets($ch); $this->assertEquals("read line\n", $line); $this->assertEquals(array("written line\n"), TestStreamWrapper::getWrites()); }
public function testCallMethodArgumentsMustBeArray() { $connection = $this->initConnection(); $response = '{"method": 42, "arguments": null}'; TestStreamWrapper::addRead($response . "\n"); $this->setExpectedException('\\DnodeSyncClient\\ProtocolException', 'Response arguments must be array: ' . $response); $connection->call("method1"); }
protected function tearDown() { TestStreamWrapper::unregister(); }