コード例 #1
0
ファイル: parser_test.php プロジェクト: Bremaweb/streber-1
 function testStateMoves()
 {
     $stack = new SimpleStateStack("one");
     $stack->enter("two");
     $this->assertEqual($stack->getCurrent(), "two");
     $stack->enter("three");
     $this->assertEqual($stack->getCurrent(), "three");
     $this->assertTrue($stack->leave());
     $this->assertEqual($stack->getCurrent(), "two");
     $stack->enter("third");
     $this->assertEqual($stack->getCurrent(), "third");
     $this->assertTrue($stack->leave());
     $this->assertTrue($stack->leave());
     $this->assertEqual($stack->getCurrent(), "one");
 }
コード例 #2
0
 public function testStateMoves()
 {
     $stack = new SimpleStateStack('one');
     $stack->enter('two');
     $this->assertEqual($stack->getCurrent(), 'two');
     $stack->enter('three');
     $this->assertEqual($stack->getCurrent(), 'three');
     $this->assertTrue($stack->leave());
     $this->assertEqual($stack->getCurrent(), 'two');
     $stack->enter('third');
     $this->assertEqual($stack->getCurrent(), 'third');
     $this->assertTrue($stack->leave());
     $this->assertTrue($stack->leave());
     $this->assertEqual($stack->getCurrent(), 'one');
 }