Revert "Do not use getDisplayName for groups" (#1062)

Revert "Do not use getDisplayName for groups"
This commit is contained in:
Julius Härtl
2019-05-23 21:32:53 +02:00
committed by GitHub
2 changed files with 15 additions and 5 deletions

View File

@@ -35,7 +35,7 @@ class Group extends RelationalObject {
public function getObjectSerialization() {
return [
'uid' => $this->object->getGID(),
'displayname' => $this->object->getGID()
'displayname' => $this->object->getDisplayName()
];
}
}

View File

@@ -33,10 +33,13 @@ class GroupTest extends \Test\TestCase {
$group->expects($this->any())
->method('getGID')
->willReturn('mygroup');
$group->expects($this->any())
->method('getDisplayName')
->willReturn('My Group');
$groupRelationalObject = new Group($group);
$expected = [
'uid' => 'mygroup',
'displayname' => 'mygroup'
'displayname' => 'My Group'
];
$this->assertEquals($expected, $groupRelationalObject->getObjectSerialization());
}
@@ -47,12 +50,19 @@ class GroupTest extends \Test\TestCase {
$group->expects($this->any())
->method('getGID')
->willReturn('mygroup');
$group->expects($this->any())
->method('getDisplayName')
->willReturn('My Group');
$groupRelationalObject = new Group($group);
$expected = [
'uid' => 'mygroup',
'displayname' => 'mygroup',
'displayname' => 'My Group',
'primaryKey' => 'mygroup'
];
$this->assertEquals($expected, $groupRelationalObject->jsonSerialize());
$actual = $groupRelationalObject->jsonSerialize();
asort($expected);
asort($actual);
$this->assertEquals($expected, $actual);
}
}
}