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()); }