@@ -33,6 +33,16 @@ public function testSetupNoTarget()
3333 $ json ->setup ([]);
3434 }
3535
36+ /**
37+ * Tests Webhook::setup
38+ */
39+ public function testUriMustBeValid ()
40+ {
41+ $ this ->expectException ('phpbu\App\Exception ' );
42+ $ json = new Webhook ();
43+ $ json ->setup (['uri ' => 'not a URI ' ]);
44+ }
45+
3646 /**
3747 * Tests Webhook::onPhpbuEnd
3848 */
@@ -46,7 +56,7 @@ public function testGet()
4656 $ phpbuEndEvent = $ this ->createMock (\phpbu \App \Event \App \End::class);
4757 $ phpbuEndEvent ->method ('getResult ' )->willReturn ($ result );
4858
49- $ uri = PHPBU_TEST_FILES . ' /misc /webhook.fail.uri ' ;
59+ $ uri = ' https:/ /webhook.fail.uri/hook ' ;
5060 $ json = new Webhook ();
5161 $ json ->setup (['uri ' => $ uri ]);
5262
@@ -66,7 +76,7 @@ public function testBasicAuth()
6676 $ phpbuEndEvent = $ this ->createMock (\phpbu \App \Event \App \End::class);
6777 $ phpbuEndEvent ->method ('getResult ' )->willReturn ($ result );
6878
69- $ uri = PHPBU_TEST_FILES . ' /misc /webhook.fail.uri ' ;
79+ $ uri = ' https:/ /webhook.fail.uri/hook ' ;
7080 $ json = new Webhook ();
7181 $ json ->setup (['uri ' => $ uri , 'username ' => 'foo ' , 'password ' => 'bar ' ]);
7282
@@ -85,7 +95,7 @@ public function testPostDefaultJsonSuccess()
8595 $ phpbuEndEvent = $ this ->createMock (\phpbu \App \Event \App \End::class);
8696 $ phpbuEndEvent ->method ('getResult ' )->willReturn ($ result );
8797
88- $ uri = PHPBU_TEST_FILES . '/misc/webhook.fake.uri ' ;
98+ $ uri = ' file:// ' . PHPBU_TEST_FILES . '/misc/webhook.fake.uri ' ;
8999 $ json = new Webhook ();
90100 $ json ->setup (['uri ' => $ uri , 'contentType ' => 'application/json ' , 'method ' => 'post ' ]);
91101
@@ -106,7 +116,7 @@ public function testPostDefaultJson()
106116 $ phpbuEndEvent = $ this ->createMock (\phpbu \App \Event \App \End::class);
107117 $ phpbuEndEvent ->method ('getResult ' )->willReturn ($ result );
108118
109- $ uri = PHPBU_TEST_FILES . ' /misc /webhook.fail.uri ' ;
119+ $ uri = ' https:/ /webhook.fail.uri/hook ' ;
110120 $ json = new Webhook ();
111121 $ json ->setup (['uri ' => $ uri , 'contentType ' => 'application/json ' , 'method ' => 'post ' ]);
112122
@@ -127,7 +137,7 @@ public function testPostXmlTemplate()
127137 $ phpbuEndEvent = $ this ->createMock (\phpbu \App \Event \App \End::class);
128138 $ phpbuEndEvent ->method ('getResult ' )->willReturn ($ result );
129139
130- $ uri = PHPBU_TEST_FILES . ' /misc /webhook.fail.uri ' ;
140+ $ uri = ' https:/ /webhook.fail.uri/hook ' ;
131141 $ path = PHPBU_TEST_FILES . '/misc/webhook.tpl ' ;
132142 $ json = new Webhook ();
133143 $ json ->setup (['uri ' => $ uri , 'contentType ' => 'application/xml ' , 'method ' => 'post ' , 'template ' => $ path ]);
@@ -151,7 +161,7 @@ public function testPostNoFormatter()
151161 $ phpbuEndEvent = $ this ->createMock (\phpbu \App \Event \App \End::class);
152162 $ phpbuEndEvent ->method ('getResult ' )->willReturn ($ result );
153163
154- $ uri = PHPBU_TEST_FILES . ' /misc /webhook.fail.uri ' ;
164+ $ uri = ' https:/ /webhook.fail.uri/hook ' ;
155165 $ json = new Webhook ();
156166 $ json ->setup (['uri ' => $ uri , 'contentType ' => 'application/html ' , 'method ' => 'post ' ]);
157167
0 commit comments