/** * @test */ public function shouldBehave() { $loader = XML::createFromFile(__DIR__ . '/../../../../assets/xml/example.xml'); $writer = new Memory(); Memory::clear(); $delegator = new ReaderWriterDelegator($loader, $writer); $this->assertSame($loader, $delegator->getReader()); $this->assertSame($writer, $delegator->getWriter()); $this->assertContains('Memory', $delegator->toString()); $this->assertContains('XML', $delegator->toString()); $this->assertContains('Memory', $delegator . ''); $this->assertContains('XML', $delegator . ''); $this->assertCount(0, $delegator->getEntityIds('test')); $this->assertFalse($delegator->isPersisted(new Identifier('123', 'bogus'))); $delegator->setFailedTransition(new Identifier('foo', 'bar'), new Transition(new State('foo'), new State('bar')), new \Exception('bogus')); }
protected function createAdapter() { $io = new Memory(); $io->clear(); return $io; }