clear() public static method

Not a method we want to have on the Adapter interface. this method is useful for testing.
public static clear ( )
 /**
  * @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'));
 }
コード例 #2
0
 protected function createAdapter()
 {
     $io = new Memory();
     $io->clear();
     return $io;
 }