@@ -16,6 +16,8 @@ class BaseServerConfigTest extends TestCase
1616{
1717 /////////////////////////////////// TESTS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
1818
19+ private const MOCK_CLIENT_ID = 'mock-client-id ' ;
20+
1921 /**
2022 * @testdox BaseServerConfig should complain when called before given a Configuration
2123 * @covers ::__construct
@@ -93,6 +95,48 @@ public function testSetUserSubDomainsEnabled($expected)
9395 $ baseServerConfig ->setUserSubDomainsEnabled ($ expected );
9496 }
9597
98+ /**
99+ * @testdox BaseServerConfig should retrieve client ID AppValue when asked to GetClientRegistration for existing client
100+ * @covers ::getClientRegistration
101+ */
102+ public function testGetClientRegistrationForExistingClient ()
103+ {
104+ $ configMock = $ this ->createMock (IConfig::class);
105+ $ baseServerConfig = new BaseServerConfig ($ configMock );
106+
107+ $ expected = ['mock ' => 'client ' ];
108+
109+ $ configMock ->expects ($ this ->once ())
110+ ->method ('getAppValue ' )
111+ ->with (Application::APP_ID , 'client- ' . self ::MOCK_CLIENT_ID )
112+ ->willReturn (json_encode ($ expected ));
113+
114+ $ actual = $ baseServerConfig ->getClientRegistration (self ::MOCK_CLIENT_ID );
115+
116+ $ this ->assertEquals ($ expected , $ actual );
117+ }
118+
119+ /**
120+ * @testdox BaseServerConfig should return empty array when asked to GetClientRegistration for non-existing client
121+ * @covers ::getClientRegistration
122+ */
123+ public function testGetClientRegistrationForNonExistingClient ()
124+ {
125+ $ configMock = $ this ->createMock (IConfig::class);
126+ $ baseServerConfig = new BaseServerConfig ($ configMock );
127+
128+ $ expected = [];
129+
130+ $ configMock ->expects ($ this ->once ())
131+ ->method ('getAppValue ' )
132+ ->with (Application::APP_ID , 'client- ' . self ::MOCK_CLIENT_ID )
133+ ->willReturnArgument (2 );
134+
135+ $ actual = $ baseServerConfig ->getClientRegistration (self ::MOCK_CLIENT_ID );
136+
137+ $ this ->assertEquals ($ expected , $ actual );
138+ }
139+
96140 /////////////////////////////// DATAPROVIDERS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
97141
98142 public function provideBooleans ()
0 commit comments