Skip to content

Commit

Permalink
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion api/tests/State/Util/AbstractPersistProcessorTest.php
Original file line number Diff line number Diff line change
@@ -42,6 +42,20 @@ protected function setUp(): void {
);

$this->processor->method('onBefore')->willReturnArgument(0);

set_error_handler(
/**
* @throws WarningException
*/
static function (int $errno, string $errstr): never {
throw new WarningException();
},
E_WARNING
);
}

protected function tearDown(): void {
restore_error_handler();
}

public function testThrowsIfOnePropertyChangeListenerIsOfWrongType() {
@@ -96,7 +110,7 @@ public function testThrowErrorIfExtractPropertyFails() {
);
$this->closure->expects(self::never())->method('call');

$this->expectWarning();
$this->expectException(WarningException::class);
$this->processor->process($toPersist, new Patch(), [], $context);
}

@@ -156,3 +170,6 @@ class MyEntity extends BaseEntity {

class MyEmptyEntity extends BaseEntity {
}

class WarningException extends \Exception {
}

0 comments on commit 62cf368

Please sign in to comment.