Skip to content

Commit 6d82b4c

Browse files
committed
Don't use with() with stubs
1 parent e5a9e70 commit 6d82b4c

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

tests/Cache/PropertyResolver/ExpressionLanguage/InverseRelationExpressionTransformerTest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ final class InverseRelationExpressionTransformerTest extends TestCase
2020
#[TestWith(['false', PropertyReadInfo::TYPE_METHOD, 'isBar', 'obj.isBar() !== null ? (obj.isBar().firstName~"-"~obj.isBar().lastName) : false'])]
2121
public function testTransform(string $fallback, string $readInfoType, string $readInfoName, string $expectedExpression): void
2222
{
23-
$extractor = self::createStub(PropertyReadInfoExtractorInterface::class);
24-
$extractor->method('getReadInfo')
23+
$extractor = $this->createMock(PropertyReadInfoExtractorInterface::class);
24+
$extractor->expects(self::once())
25+
->method('getReadInfo')
2526
->with(\stdClass::class, 'prop')
2627
->willReturn(
2728
new PropertyReadInfo(
@@ -42,8 +43,9 @@ public function testTransform(string $fallback, string $readInfoType, string $re
4243

4344
public function testExceptionIsThrownWhenPropertyIsNotAccessible(): void
4445
{
45-
$extractor = self::createStub(PropertyReadInfoExtractorInterface::class);
46-
$extractor->method('getReadInfo')
46+
$extractor = $this->createMock(PropertyReadInfoExtractorInterface::class);
47+
$extractor->expects(self::once())
48+
->method('getReadInfo')
4749
->with(\stdClass::class, 'prop')
4850
->willReturn(null);
4951

tests/Cache/PropertyResolver/InverseValuesBuildersTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ final class InverseValuesBuildersTest extends TestCase
2929
{
3030
public function testBuild(): void
3131
{
32-
$extractor = self::createStub(PropertyReadInfoExtractorInterface::class);
33-
$extractor->method('getReadInfo')
32+
$extractor = $this->createMock(PropertyReadInfoExtractorInterface::class);
33+
$extractor->expects(self::once())
34+
->method('getReadInfo')
3435
->with(\stdClass::class, 'association')
3536
->willReturn(
3637
new PropertyReadInfo(

0 commit comments

Comments
 (0)