/** * @group Dispatcher * @group Dispatcher_StateFactory */ function testFactory_string_no_prev() { $state = __NAMESPACE__ . '\\Init'; $data = new SampleData(); $instance = new StateFactory($data); $result = $instance->factory(null, $state); $this->assertSame($state, get_class($result)); $this->assertSame($data, $result->getData()); }
protected function factoryState($newState) { foreach ($this->_stateFactory as $factory) { if ($factory->isAccept($newState)) { return $factory->factory($this->getState(), $newState); } } $factory = new StateFactory($this->getState()->getData()); return $factory->factory(null, $newState); }