@@ -320,6 +320,38 @@ public function testListUserStatusTransitions_withParameters() {
320320 \Phake::verify ($ apiClientMock )->doGet ('/rest/v3/users/{user-token}/status-transitions ' , array ('user-token ' => 'test-user-token ' ), array ('test ' => 'value ' ));
321321 }
322322
323+ //--------------------------------------
324+ // Client Token
325+ //--------------------------------------
326+
327+ public function testGetClientToken_noUserToken () {
328+ // Setup
329+ $ client = new Hyperwallet ('test-username ' , 'test-password ' );
330+
331+ try {
332+ $ client ->getClientToken ('' );
333+ $ this ->fail ('HyperwalletArgumentException expected ' );
334+ } catch (HyperwalletArgumentException $ e ) {
335+ $ this ->assertEquals ('userToken is required! ' , $ e ->getMessage ());
336+ }
337+ }
338+
339+ public function testGetClientToken_allParameters () {
340+ // Setup data
341+ $ client = new Hyperwallet ('test-username ' , 'test-password ' , 'test-program-token ' );
342+ $ apiClientMock = $ this ->createAndInjectApiClientMock ($ client );
343+
344+ \Phake::when ($ apiClientMock )->doPost ('/rest/v3/users/{user-token}/client-token ' , array ('user-token ' => 'test-user-token ' ), null , array ())->thenReturn (array ('value ' => 'true ' ));
345+
346+ // Run test
347+ $ clientToken = $ client ->getClientToken ('test-user-token ' );
348+ $ this ->assertNotNull ($ clientToken );
349+ $ this ->assertEquals (array ('value ' => 'true ' ), $ clientToken ->getProperties ());
350+
351+ // Validate mock
352+ \Phake::verify ($ apiClientMock )->doPost ('/rest/v3/users/{user-token}/client-token ' , array ('user-token ' => 'test-user-token ' ), null , array ());
353+ }
354+
323355 //--------------------------------------
324356 // Paper Checks
325357 //--------------------------------------
0 commit comments