Skip to content

Commit

Permalink
[Tests] Aligned tests with the changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alongosz committed May 23, 2024
1 parent 12b19df commit e23f8d0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function testThrowsExceptionOnBadFieldIdentifier()
'internalFields' => [],
'versionInfo' => new VersionInfo(
[
'contentInfo' => new ContentInfo(['mainLanguageCode' => 'eng-GB']),
'contentInfo' => new ContentInfo(['id' => 1, 'mainLanguageCode' => 'eng-GB']),
]
),
]
Expand Down
21 changes: 11 additions & 10 deletions tests/lib/MVC/Symfony/Security/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,23 @@ public function testSetAPIUser()
$this->assertSame($apiUserB, $user->getAPIUser());
}

public function testToString()
public function testToString(): void
{
$fullName = 'My full name';
$userContentInfo = $this
->getMockBuilder(ContentInfo::class)
->setConstructorArgs([['name' => $fullName]])
->getMockForAbstractClass();
$userContentInfo = $this->createMock(ContentInfo::class);

$userContentInfo
->method('getName')
->willReturn($fullName);

$apiUser = $this->createMock(APIUser::class);
$apiUser
->expects($this->any())
->method('__get')
->with('contentInfo')
->will($this->returnValue($userContentInfo));
->method('getContentInfo')
->with()
->willReturn($userContentInfo);

$user = new User($apiUser);
$this->assertSame($fullName, (string)$user);
self::assertSame($fullName, (string)$user);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ public function testBuildViewWithoutContentReadPermission(): void
'invisible' => false,
'content' => new Content([
'versionInfo' => new VersionInfo([
'contentInfo' => new ContentInfo(),
'id' => 2,
'contentInfo' => new ContentInfo(['id' => 1]),
]),
]),
]
Expand Down

0 comments on commit e23f8d0

Please sign in to comment.