@@ -55,7 +55,7 @@ public function requiredParamsProvider()
55
55
*/
56
56
public function testSendingSearchRequestsWithoutRequiredParamsWillThrowAnException (array $ options )
57
57
{
58
- $ this ->httpClientMock ->method ('request ' )->willReturn ($ this ->responseMock );
58
+ $ this ->httpClientMock ->method ('get ' )->willReturn ($ this ->responseMock );
59
59
$ this ->responseMock ->method ('getBody ' )->willReturn ($ this ->streamMock );
60
60
$ this ->responseMock ->method ('getStatusCode ' )->willReturn (200 );
61
61
$ this ->streamMock ->method ('getContents ' )
@@ -88,7 +88,7 @@ public function testSendingSearchRequestsWithoutRequiredParamsWillThrowAnExcepti
88
88
89
89
public function testSendingNavigationRequestsWithoutRequiredParamsWillThrowAnException ()
90
90
{
91
- $ this ->httpClientMock ->method ('request ' )->willReturn ($ this ->responseMock );
91
+ $ this ->httpClientMock ->method ('get ' )->willReturn ($ this ->responseMock );
92
92
$ this ->responseMock ->method ('getBody ' )->willReturn ($ this ->streamMock );
93
93
$ this ->responseMock ->method ('getStatusCode ' )->willReturn (200 );
94
94
$ this ->streamMock ->method ('getContents ' )
@@ -648,6 +648,39 @@ public function testInvalidGroupWillThrowAnException($invalidGroup)
648
648
$ searchRequest ->addGroup ($ invalidGroup );
649
649
}
650
650
651
+ /**
652
+ * @dataProvider userGroupProvider
653
+ *
654
+ * @param string $expectedUserGroupHash
655
+ */
656
+ public function testAddUserGroupWillSetItInAValidFormat ($ expectedUserGroupHash )
657
+ {
658
+ $ expectedParameter = 'usergrouphash ' ;
659
+
660
+ $ searchRequest = new SearchRequest ();
661
+ $ this ->setRequiredParamsForSearchNavigationRequest ($ searchRequest );
662
+
663
+ $ searchRequest ->addUserGroup ($ expectedUserGroupHash );
664
+ $ params = $ searchRequest ->getParams ();
665
+ $ this ->assertArrayHasKey ($ expectedParameter , $ params );
666
+ $ this ->assertEquals ([$ expectedUserGroupHash ], $ params [$ expectedParameter ]);
667
+ }
668
+
669
+ /**
670
+ * @dataProvider invalidUserGroupProvider
671
+ * @param mixed $invalidUserGroup
672
+ */
673
+ public function testInvalidUserGroupWillThrowAnException ($ invalidUserGroup )
674
+ {
675
+ $ this ->expectException (InvalidParamException::class);
676
+ $ this ->expectExceptionMessage ('Parameter usergrouphash is not valid. ' );
677
+
678
+ $ searchRequest = new SearchRequest ();
679
+ $ this ->setRequiredParamsForSearchNavigationRequest ($ searchRequest );
680
+
681
+ $ searchRequest ->addUserGroup ($ invalidUserGroup );
682
+ }
683
+
651
684
/**
652
685
* @dataProvider attributeProvider
653
686
* @param string $expectedAttributeName
0 commit comments