Kraken\_Module\Channel\ChannelModelTest::testChannelModel_DoesNotAllowStoppingMultipleTimesInRow PHP Method

testChannelModel_DoesNotAllowStoppingMultipleTimesInRow() public method

    public function testChannelModel_DoesNotAllowStoppingMultipleTimesInRow($data)
    {
        $this->simulate(function (SimulationInterface $sim) use($data) {
            $loop = $sim->getLoop();
            $master = $this->createModel($data['master'], $loop);
            $master->on('start', function () use($sim) {
                $sim->expect('start');
            });
            $master->on('stop', function () use($sim) {
                $sim->expect('stop');
            });
            $master->delayOnce('stop', 2, function () use($sim) {
                $sim->fail('Stop have been called twice, but it should not be possible!');
            });
            $sim->onStart(function () use($sim, $master) {
                $master->start();
                $sim->done();
            });
            $sim->onStop(function () use($master) {
                $master->stop();
                $master->stop();
            });
        })->expect([['start'], ['stop']]);
    }