Skip to content

Commit

Permalink
test: do not use deprecated methods (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
simPod committed Feb 3, 2023
1 parent da4445a commit c6f95e7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tests/StubTest.php
Expand Up @@ -70,10 +70,15 @@ public function testPrivateReadonlyPropertyIsSetBypassingConstructor(): void
/** PHP does not allow setting protected or public readonly properties from different scopes */
public function testPublicReadonlyPropertyCannotBeSet(): void
{
$this->expectException(Error::class);
$this->expectErrorMessage('Cannot initialize readonly property');
$this->expectErrorMessage('from scope');
try {
Stub::create(ClassWithReadonlyProperty::class, ['parentPublicReadonlyProperty' => 'value']);
} catch (Error $e) {
self::assertStringContainsString('Cannot initialize readonly property', $e->getMessage());
self::assertStringContainsString('from scope', $e->getMessage());

return;
}

Stub::create(ClassWithReadonlyProperty::class, ['parentPublicReadonlyProperty' => 'value']);
self::fail('Expected error was not thrown');
}
}

0 comments on commit c6f95e7

Please sign in to comment.