public function testStateChanges() { $item = new Item(); $this->assertInstanceOf(StateInit::class, $item->getState()); $this->assertInstanceOf(StateInit::class, $item->pause()->getState()); $this->assertInstanceOf(StateInit::class, $item->resume()->getState()); $this->assertInstanceOf(StateInit::class, $item->stop()->getState()); $this->assertInstanceOf(StateInit::class, $item->discard()->getState()); $this->assertInstanceOf(StateRunning::class, $item->start()->getState()); $this->assertInstanceOf(StateRunning::class, $item->start()->getState()); $this->assertInstanceOf(StateRunning::class, $item->resume()->getState()); $this->assertInstanceOf(StatePaused::class, $item->pause()->getState()); $this->assertInstanceOf(StatePaused::class, $item->pause()->getState()); $this->assertInstanceOf(StatePaused::class, $item->start()->getState()); $this->assertInstanceOf(StateStopped::class, $item->stop()->getState()); $this->assertInstanceOf(StateStopped::class, $item->start()->getState()); $this->assertInstanceOf(StateStopped::class, $item->pause()->getState()); $this->assertInstanceOf(StateStopped::class, $item->resume()->getState()); $this->assertInstanceOf(StateStopped::class, $item->stop()->getState()); $this->assertInstanceOf(StateStopped::class, $item->discard()->getState()); $this->assertInstanceOf(StateInit::class, $item->setInitState()->getState()); $this->assertInstanceOf(StateInit::class, $item->start()->discard()->getState()); $this->assertInstanceOf(StateInit::class, $item->start()->pause()->discard()->getState()); $this->assertInstanceOf(StateStopped::class, $item->start()->stop()->getState()); $cloned = clone $item; $this->assertInstanceOf(StateInit::class, $cloned->getState()); }