Don't allow setting data that couldn't be retrieved
[MAILPOET-4463]
This commit is contained in:
committed by
Jan Jakeš
parent
f126bdb2b9
commit
bf0f8a4dc5
@ -58,6 +58,16 @@ class WorkflowRunLogTest extends \MailPoetTest {
|
||||
$this->assertSame('value', $data['key']);
|
||||
}
|
||||
|
||||
public function testItDoesNotAllowSettingDataThatCannotBeSaved(): void {
|
||||
$log = new WorkflowRunLog(1, 'step-id', []);
|
||||
$badData = [
|
||||
function() { echo 'closures cannot be serialized'; }
|
||||
];
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$log->setData('badData', $badData);
|
||||
expect($log->getData())->count(0);
|
||||
}
|
||||
|
||||
public function testItGetsExposedViaAction(): void {
|
||||
$this->wp->addAction(Hooks::WORKFLOW_RUN_LOG_AFTER_STEP_RUN, function(WorkflowRunLog $log) {
|
||||
$log->setData('test', 'value');
|
||||
|
Reference in New Issue
Block a user