Skip to content

Commit

Permalink
AbstractPersistProcessorTest: replace expectWarning mit expectException
Browse files Browse the repository at this point in the history
  • Loading branch information
BacLuc committed May 6, 2023
1 parent 6664a62 commit cdefa9d
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion api/tests/State/Util/AbstractPersistProcessorTest.php
Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
}

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

class MyEmptyEntity extends BaseEntity {
}

class WarningException extends \Exception {
}

0 comments on commit cdefa9d

Please sign in to comment.