public function testProtectedApiSetLoopState_StopsLoopAndChangesState_WhenNewStateDoesNotMatchCurrent()
{
$runtime = $this->createModel([], ['stopLoop']);
$runtime->expects($this->once())->method('stopLoop');
$old = RuntimeModel::LOOP_STATE_STOPPED;
$new = RuntimeModel::LOOP_STATE_STARTED;
$this->setProtectedProperty($runtime, 'loopState', $old);
$this->callProtectedMethod($runtime, 'setLoopState', [$new]);
$this->assertSame($new, $this->getProtectedProperty($runtime, 'loopState'));
}