Set('log_level_min', [LogChannels::DM_CRUD => 'Debug', LogChannels::EVENT_SERVICE => 'Trace']); } } protected function tearDown(): void { if (is_file(APPROOT.static::$sLogFile)) { $sLog = file_get_contents(APPROOT.static::$sLogFile); echo "--- error.log\n$sLog\n\n"; @unlink(APPROOT.static::$sLogFile); } parent::tearDown(); } public function testStimulusStoppingActionPreventObjectModification() { // Given $sObjectKey = $this->GivenObjectInDB('TestDBObject', ['name' => 'parent', 'status' => 'new']); $oParent = MetaModel::GetObject('TestDBObject', $sObjectKey); // When actions ApplyStimulus then next action fails $oParent->ApplyStimulus('ev_assign'); $oParent->Reload(); // Then // Check status... $this->assertEquals('new', $oParent->Get('status'), 'The status should have remained unmodified due to action failure'); } public function testCallingApplyStimulusWithinActionsWorks() { // Given $sObjectKey = $this->GivenObjectInDB('TestDBObject', ['name' => 'parent', 'status' => 'assigned']); $oParent = MetaModel::GetObject('TestDBObject', $sObjectKey); // When action ApplyStimulus $oParent->ApplyStimulus('ev_reassign'); $oParent->Reload(); // Then // Check that status has changed to the final status $this->assertEquals('resolved', $oParent->Get('status'), 'The status should have been modified to resolved (the final state after a nested stimulus)'); } }