From 8e7694e09b852a01b431ebce2c1c99e4945f23b8 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 2 Jan 2022 10:00:28 +0100 Subject: [PATCH] authPDO: extend mysql test to ensure multiple groups are read I noticed that all our tests basically only ever used one group per user. This makes sure multiple groups work as intended. --- lib/plugins/authpdo/_test/sqlite.test.php | 14 +++++++------- lib/plugins/authpdo/_test/test.sqlite3 | Bin 14336 -> 14336 bytes 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/plugins/authpdo/_test/sqlite.test.php b/lib/plugins/authpdo/_test/sqlite.test.php index 58fcadcb8..4816f8e33 100644 --- a/lib/plugins/authpdo/_test/sqlite.test.php +++ b/lib/plugins/authpdo/_test/sqlite.test.php @@ -106,7 +106,7 @@ class sqlite_plugin_authpdo_test extends DokuWikiTest { $this->assertTrue($ok); $groups = $auth->selectGroups(); $this->assertArrayHasKey('test', $groups); - $this->assertEquals(3, $groups['test']['gid']); + $this->assertEquals(4, $groups['test']['gid']); } /** @@ -131,12 +131,12 @@ class sqlite_plugin_authpdo_test extends DokuWikiTest { $this->assertEquals('admin', $info['user']); $this->assertEquals('The Admin', $info['name']); $this->assertEquals('admin@example.com', $info['mail']); - $this->assertEquals(array('admin', 'user'), $info['grps']); + $this->assertEquals(array('additional', 'admin', 'user'), $info['grps']); // group retrieval - $this->assertEquals(array('admin', 'user'), $auth->retrieveGroups()); - $this->assertEquals(array('user'), $auth->retrieveGroups(1)); - $this->assertEquals(array('admin'), $auth->retrieveGroups(0, 1)); + $this->assertEquals(array('additional', 'admin', 'user'), $auth->retrieveGroups()); + $this->assertEquals(array('admin', 'user'), $auth->retrieveGroups(1)); + $this->assertEquals(array('additional'), $auth->retrieveGroups(0, 1)); // user creation $auth->createUser('test', 'password', 'A Test user', 'test@example.com', array('newgroup')); @@ -145,7 +145,7 @@ class sqlite_plugin_authpdo_test extends DokuWikiTest { $this->assertEquals('A Test user', $info['name']); $this->assertEquals('test@example.com', $info['mail']); $this->assertEquals(array('newgroup', 'user'), $info['grps']); - $this->assertEquals(array('admin', 'newgroup', 'user'), $auth->retrieveGroups()); + $this->assertEquals(array('additional', 'admin', 'newgroup', 'user'), $auth->retrieveGroups()); // user modification $auth->modifyUser('test', array('user' => 'tester', 'name' => 'The Test User', 'pass' => 'secret')); @@ -166,7 +166,7 @@ class sqlite_plugin_authpdo_test extends DokuWikiTest { 'name' => 'The Admin', 'mail' => 'admin@example.com', 'uid' => '1', - 'grps' => array('admin', 'user') + 'grps' => array('additional', 'admin', 'user') ), 'user' => array( 'user' => 'user', diff --git a/lib/plugins/authpdo/_test/test.sqlite3 b/lib/plugins/authpdo/_test/test.sqlite3 index 8d3a9ba612c92804c33a14d8723689b7ca3a959f..9cf5e1475bc437747a9476b46c01ad892f81a224 100644 GIT binary patch delta 173 zcwR-#u?m7v7>42V`~4LstdmO)2_X$_-9kfGBDe@q4qbp_W8sy=xsh4|7u^JhV@pxc z(s62ghX>v)&C=71ymPSWd1AFLF7Z(jv{An6GHQV@o~U8;B)DVHXGsLk&D-)F#l%$0;G613&>n!o*2N! z$Ugb4yf_CFNa{QD+s%S351A*wRR)Q?V_<&A`~xWRh