File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
test/Bitbucket/Tests/API/Repositories Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,46 @@ public function testGetRepository()
2525 $ this ->assertEquals ($ expectedResult , $ actual );
2626 }
2727
28+ /**
29+ * @return array of invalid value for repo creations parameter
30+ */
31+ public function invalidCreateProvider ()
32+ {
33+ return array (
34+ array ('' ),
35+ array ("\t" ),
36+ array ("\n" ),
37+ array (' ' ),
38+ array ("{ 'bar': 'baz' } " ),
39+ array ('{ repo: "company", } ' ),
40+ array ('{ repo: "company" } ' ),
41+ array (
42+ substr (
43+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ " ,
44+ mt_rand ( 0 ,50 ) ,1 ) .substr ( md5 ( time () ), 1 )
45+ )
46+ );
47+
48+ }
49+
50+ /**
51+ * @param $check
52+ * @param $expectation
53+ * @return mixed
54+ * @expectedException \InvalidArgumentException
55+ * @dataProvider invalidCreateProvider
56+ */
57+ public function testInvalidCreate ($ check )
58+ {
59+
60+ $ client = $ this ->getHttpClientMock ();
61+
62+ /** @var \Bitbucket\API\Repositories\Repository $repo */
63+ $ repo = $ this ->getClassMock ('Bitbucket\API\Repositories\Repository ' , $ client );
64+ $ this ->setExpectedException ('\InvalidArgumentException ' );
65+ $ repo ->create ('gentle ' , 'new-repo ' , $ check );
66+ }
67+
2868 public function testCreateRepositoryFromJSON ()
2969 {
3070 $ endpoint = 'repositories/gentle/new-repo ' ;
You can’t perform that action at this time.
0 commit comments