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"); }
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'); }