File tree 2 files changed +24
-3
lines changed
2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -31,11 +31,12 @@ abstract class BasicTest extends TestCase
31
31
32
32
/**
33
33
* @before
34
+ * @param $url
34
35
*/
35
- public function setUp ()
36
+ public function setUp ($ url = " http://localhost:9999 " )
36
37
{
37
38
$ this ->client = new Client ([
38
- "url " => " http://localhost:9999 " ,
39
+ "url " => $ url ,
39
40
"token " => "my-token " ,
40
41
"bucket " => "my-bucket " ,
41
42
"precision " => WritePrecision::NS ,
Original file line number Diff line number Diff line change 3
3
namespace InfluxDB2Test ;
4
4
5
5
use GuzzleHttp \Psr7 \Response ;
6
- use InvalidArgumentException ;
7
6
use InfluxDB2 \ApiException ;
7
+ use InvalidArgumentException ;
8
8
9
9
require_once ('BasicTest.php ' );
10
10
@@ -21,6 +21,26 @@ public function testUserAgent()
21
21
strval ($ request ->getHeader ("User-Agent " )[0 ]));
22
22
}
23
23
24
+ public function testTrailingSlashInUrl ()
25
+ {
26
+ $ this ->mockHandler ->append (new Response (204 ));
27
+ $ this ->writeApi ->write ('h2o,location=west value=33i 15 ' );
28
+
29
+ $ request = $ this ->mockHandler ->getLastRequest ();
30
+
31
+ $ this ->assertEquals ('http://localhost:9999/api/v2/write?org=my-org&bucket=my-bucket&precision=ns ' , strval ($ request ->getUri ()));
32
+
33
+ $ this ->tearDown ();
34
+ $ this ->setUp ("http://localhost:9999/ " );
35
+
36
+ $ this ->mockHandler ->append (new Response (204 ));
37
+ $ this ->writeApi ->write ('h2o,location=west value=33i 15 ' );
38
+
39
+ $ request = $ this ->mockHandler ->getLastRequest ();
40
+
41
+ $ this ->assertEquals ('http://localhost:9999/api/v2/write?org=my-org&bucket=my-bucket&precision=ns ' , strval ($ request ->getUri ()));
42
+ }
43
+
24
44
public function testContentType ()
25
45
{
26
46
$ this ->mockHandler ->append (new Response (204 ));
You can’t perform that action at this time.
0 commit comments