@@ -25,12 +25,12 @@ class AssignedUsersMapperTest extends \Test\TestCase {
2525 protected $ assignedUsersMapper ;
2626 /** @var AssignmentService */
2727 private $ assignmentService ;
28- /** @var Board */
29- private $ board ;
30- private $ cards ;
31- private $ stacks ;
28+ /** @var Board */
29+ private $ board ;
30+ private $ cards ;
31+ private $ stacks ;
3232
33- public static function setUpBeforeClass (): void {
33+ public static function setUpBeforeClass (): void {
3434 parent ::setUpBeforeClass ();
3535
3636 $ backend = new \Test \Util \User \Dummy ();
@@ -60,82 +60,77 @@ public function createBoardWithExampleData() {
6060 $ stacks = [];
6161 $ board = $ this ->boardService ->create ('Test ' , self ::TEST_OWNER , '000000 ' );
6262 $ id = $ board ->getId ();
63- $ this ->boardService ->addAcl ($ id , Acl::PERMISSION_TYPE_USER , self ::TEST_OWNER , true , true , true );
64- $ this ->boardService ->addAcl ($ id , Acl::PERMISSION_TYPE_GROUP , self ::TEST_GROUP , true , true , true );
63+ $ this ->boardService ->addAcl ($ id , Acl::PERMISSION_TYPE_USER , self ::TEST_OWNER , true , true , true );
64+ $ this ->boardService ->addAcl ($ id , Acl::PERMISSION_TYPE_GROUP , self ::TEST_GROUP , true , true , true );
6565 $ stacks [] = $ this ->stackService ->create ('Stack A ' , $ id , 1 );
6666 $ stacks [] = $ this ->stackService ->create ('Stack B ' , $ id , 1 );
6767 $ stacks [] = $ this ->stackService ->create ('Stack C ' , $ id , 1 );
6868 $ cards [] = $ this ->cardService ->create ('Card 1 ' , $ stacks [0 ]->getId (), 'text ' , 0 , self ::TEST_OWNER );
6969 $ cards [] = $ this ->cardService ->create ('Card 2 ' , $ stacks [0 ]->getId (), 'text ' , 0 , self ::TEST_OWNER );
70- $ this ->assignmentService ->assignUser ($ cards [0 ]->getId (), self ::TEST_OWNER );
71- $ this ->board = $ board ;
70+ $ this ->assignmentService ->assignUser ($ cards [0 ]->getId (), self ::TEST_OWNER );
71+ $ this ->board = $ board ;
7272 $ this ->cards = $ cards ;
7373 $ this ->stacks = $ stacks ;
7474 }
7575
76- /**
77- * @covers ::transferOwnership
78- */
79- public function testTransferBoardOwnership ()
80- {
81- $ this ->boardService ->transferOwnership (self ::TEST_OWNER , self ::TEST_NEW_OWNER );
82- $ board = $ this ->boardService ->find ($ this ->board ->getId ());
83- $ boardOwner = $ board ->getOwner ();
84- $ this ->assertEquals (self ::TEST_NEW_OWNER , $ boardOwner );
85- }
76+ /**
77+ * @covers ::transferOwnership
78+ */
79+ public function testTransferBoardOwnership () {
80+ $ this ->boardService ->transferOwnership (self ::TEST_OWNER , self ::TEST_NEW_OWNER );
81+ $ board = $ this ->boardService ->find ($ this ->board ->getId ());
82+ $ boardOwner = $ board ->getOwner ();
83+ $ this ->assertEquals (self ::TEST_NEW_OWNER , $ boardOwner );
84+ }
8685
87- /**
88- * @covers ::transferOwnership
89- */
90- public function testTransferACLOwnership ()
91- {
92- $ this ->boardService ->transferOwnership (self ::TEST_OWNER , self ::TEST_NEW_OWNER );
93- $ board = $ this ->boardService ->find ($ this ->board ->getId ());
94- $ acl = $ board ->getAcl ();
95- $ isTargetInAcl = (bool )array_filter ($ acl , function ($ item ) {
96- return $ item ->getParticipant () === self ::TEST_NEW_OWNER && $ item ->getType () === Acl::PERMISSION_TYPE_USER ;
97- });
98- $ this ->assertTrue ($ isTargetInAcl );
99- }
86+ /**
87+ * @covers ::transferOwnership
88+ */
89+ public function testTransferACLOwnership () {
90+ $ this ->boardService ->transferOwnership (self ::TEST_OWNER , self ::TEST_NEW_OWNER );
91+ $ board = $ this ->boardService ->find ($ this ->board ->getId ());
92+ $ acl = $ board ->getAcl ();
93+ $ isTargetInAcl = (bool )array_filter ($ acl , function ($ item ) {
94+ return $ item ->getParticipant () === self ::TEST_NEW_OWNER && $ item ->getType () === Acl::PERMISSION_TYPE_USER ;
95+ });
96+ $ this ->assertTrue ($ isTargetInAcl );
97+ }
10098
101- /**
102- * @covers ::transferOwnership
103- */
104- public function testNoTransferAclOwnershipIfGroupType ()
105- {
106- $ this ->boardService ->transferOwnership (self ::TEST_OWNER , self ::TEST_NEW_OWNER );
107- $ board = $ this ->boardService ->find ($ this ->board ->getId ());
108- $ acl = $ board ->getAcl ();
109- $ isGroupInAcl = (bool )array_filter ($ acl , function ($ item ) {
110- return $ item ->getParticipant () === self ::TEST_GROUP && $ item ->getType () === Acl::PERMISSION_TYPE_GROUP ;
111- });
112- $ this ->assertTrue ($ isGroupInAcl );
113- }
114- /**
115- * @covers ::transferOwnership
116- */
117- public function testTransferCardOwnership ()
118- {
119- $ this ->boardService ->transferOwnership (self ::TEST_OWNER , self ::TEST_NEW_OWNER );
120- $ card = $ this ->cardService ->find ($ this ->cards [0 ]->getId ());
121- $ cardOwner = $ card ->getOwner ();
122- $ this ->assertEquals (self ::TEST_NEW_OWNER , $ cardOwner );
123- }
99+ /**
100+ * @covers ::transferOwnership
101+ */
102+ public function testNoTransferAclOwnershipIfGroupType () {
103+ $ this ->boardService ->transferOwnership (self ::TEST_OWNER , self ::TEST_NEW_OWNER );
104+ $ board = $ this ->boardService ->find ($ this ->board ->getId ());
105+ $ acl = $ board ->getAcl ();
106+ $ isGroupInAcl = (bool )array_filter ($ acl , function ($ item ) {
107+ return $ item ->getParticipant () === self ::TEST_GROUP && $ item ->getType () === Acl::PERMISSION_TYPE_GROUP ;
108+ });
109+ $ this ->assertTrue ($ isGroupInAcl );
110+ }
111+ /**
112+ * @covers ::transferOwnership
113+ */
114+ public function testTransferCardOwnership () {
115+ $ this ->boardService ->transferOwnership (self ::TEST_OWNER , self ::TEST_NEW_OWNER );
116+ $ card = $ this ->cardService ->find ($ this ->cards [0 ]->getId ());
117+ $ cardOwner = $ card ->getOwner ();
118+ $ this ->assertEquals (self ::TEST_NEW_OWNER , $ cardOwner );
119+ }
124120
125- /**
126- * @covers ::transferOwnership
127- */
128- public function testReassignCardToNewOwner ()
129- {
130- $ this ->boardService ->transferOwnership (self ::TEST_OWNER , self ::TEST_NEW_OWNER );
131- $ assignedUsers = $ this ->assignedUsersMapper ->find ($ this ->cards [0 ]->getId ());
132- $ participantsUIDs = [];
133- foreach ($ assignedUsers as $ user ) {
134- $ participantsUIDs [] = $ user ->getParticipant ();
135- }
136- $ this ->assertContains (self ::TEST_NEW_OWNER , $ participantsUIDs );
137- $ this ->assertNotContains (self ::TEST_OWNER , $ participantsUIDs );
138- }
121+ /**
122+ * @covers ::transferOwnership
123+ */
124+ public function testReassignCardToNewOwner () {
125+ $ this ->boardService ->transferOwnership (self ::TEST_OWNER , self ::TEST_NEW_OWNER );
126+ $ assignedUsers = $ this ->assignedUsersMapper ->find ($ this ->cards [0 ]->getId ());
127+ $ participantsUIDs = [];
128+ foreach ($ assignedUsers as $ user ) {
129+ $ participantsUIDs [] = $ user ->getParticipant ();
130+ }
131+ $ this ->assertContains (self ::TEST_NEW_OWNER , $ participantsUIDs );
132+ $ this ->assertNotContains (self ::TEST_OWNER , $ participantsUIDs );
133+ }
139134
140135 public function tearDown (): void {
141136 $ this ->boardService ->deleteForce ($ this ->board ->getId ());
0 commit comments