コード例 #1
0
ファイル: Test.php プロジェクト: olegre/php-design-patterns
 public function testObserver()
 {
     $context = new context(new StateA());
     $this->assertInstanceOf('Behavioral\\State\\State\\A', $context->getState());
     $context->request();
     $this->assertInstanceOf('Behavioral\\State\\State\\B', $context->getState());
     $context->request();
     $this->assertInstanceOf('Behavioral\\State\\State\\C', $context->getState());
     $context->request();
     $this->assertInstanceOf('Behavioral\\State\\State\\A', $context->getState());
 }