This repository was archived by the owner on May 1, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +62
-1
lines changed
test/ZfModuleTest/Integration/Controller Expand file tree Collapse file tree 2 files changed +62
-1
lines changed Original file line number Diff line number Diff line change 5454 'type ' => 'Segment ' ,
5555 'options ' => [
5656 'route ' => '/list[/:owner] ' ,
57- 'constrains ' => [
57+ 'constraints ' => [
5858 'owner ' => '[a-zA-Z][a-zA-Z0-9_-]* ' ,
5959 ],
6060 'defaults ' => [
Original file line number Diff line number Diff line change @@ -228,6 +228,67 @@ public function testOrganizationActionFetches100MostRecentlyUpdatedRepositoriesW
228228 $ this ->assertResponseStatusCode (Http \Response::STATUS_CODE_200 );
229229 }
230230
231+ /**
232+ * @dataProvider providerInvalidVendor
233+ * @param $vendor
234+ */
235+ public function testOrganizationActionDoesNotMatchOnInvalidVendor ($ vendor )
236+ {
237+ $ this ->authenticatedAs (new User ());
238+
239+ $ repositoryCollection = $ this ->repositoryCollectionMock ();
240+
241+ $ repositoryRetriever = $ this ->getMockBuilder (RepositoryRetriever::class)
242+ ->disableOriginalConstructor ()
243+ ->getMock ()
244+ ;
245+
246+ $ repositoryRetriever
247+ ->expects ($ this ->any ())
248+ ->method ('getUserRepositories ' )
249+ ->with (
250+ $ this ->equalTo ($ vendor ),
251+ $ this ->equalTo ([
252+ 'per_page ' => 100 ,
253+ 'sort ' => 'updated ' ,
254+ 'direction ' => 'desc ' ,
255+ ]
256+ ))
257+ ->willReturn ($ repositoryCollection )
258+ ;
259+
260+ $ this ->getApplicationServiceLocator ()
261+ ->setAllowOverride (true )
262+ ->setService (
263+ RepositoryRetriever::class,
264+ $ repositoryRetriever
265+ )
266+ ;
267+
268+ $ url = sprintf (
269+ '/module/list/%s ' ,
270+ $ vendor
271+ );
272+
273+ $ this ->dispatch ($ url );
274+
275+ $ event = $ this ->getApplication ()->getMvcEvent ();
276+
277+ $ this ->assertSame (Mvc \Application::ERROR_ROUTER_NO_MATCH , $ event ->getError ());
278+ }
279+
280+ /**
281+ * @return array
282+ */
283+ public function providerInvalidVendor ()
284+ {
285+ return [
286+ [
287+ '9 ' ,
288+ ],
289+ ];
290+ }
291+
231292 public function testOrganizationActionFetches100MostRecentlyUpdatedRepositoriesWithOwnerSpecified ()
232293 {
233294 $ this ->authenticatedAs (new User ());
You can’t perform that action at this time.
0 commit comments