2
2
3
3
namespace spec \NewTwitchApi ;
4
4
5
- use GuzzleHttp \ Psr7 \ Uri ;
5
+ use NewTwitchApi \ HelixGuzzleClient ;
6
6
use PhpSpec \ObjectBehavior ;
7
7
8
8
class HelixGuzzleClientSpec extends ObjectBehavior
9
9
{
10
+ function let (HelixGuzzleClient $ guzzleClient )
11
+ {
12
+ $ this ->beConstructedWith ('TEST_CLIENT_ID ' );
13
+ }
14
+
10
15
function it_should_have_correct_base_uri ()
11
16
{
12
- $ this ->beConstructedThrough ('getClient ' , ['client-id ' ]);
13
- $ this ->shouldHaveType ('\GuzzleHttp\Client ' );
17
+ $ this ->shouldHaveType ('\NewTwitchApi\HelixGuzzleClient ' );
14
18
15
19
/** @var Uri $uri */
16
20
$ uri = $ this ->getConfig ('base_uri ' );
@@ -21,22 +25,21 @@ function it_should_have_correct_base_uri()
21
25
22
26
function it_should_have_client_id_header ()
23
27
{
24
- $ this ->beConstructedThrough ('getClient ' , ['client-id ' ]);
25
- $ this ->shouldHaveType ('\GuzzleHttp\Client ' );
26
- $ this ->getConfig ('headers ' )->shouldHaveKeyWithValue ('Client-ID ' , 'client-id ' );
28
+ $ this ->shouldHaveType ('\NewTwitchApi\HelixGuzzleClient ' );
29
+ $ this ->getConfig ('headers ' )->shouldHaveKeyWithValue ('Client-ID ' , 'TEST_CLIENT_ID ' );
27
30
}
28
31
29
32
function it_should_have_json_content_type_header ()
30
33
{
31
- $ this -> beConstructedThrough ( ' getClient ' , [ ' client-id ' ]);
32
- $ this ->shouldHaveType ('\GuzzleHttp\Client ' );
34
+
35
+ $ this ->shouldHaveType ('\NewTwitchApi\HelixGuzzleClient ' );
33
36
$ this ->getConfig ('headers ' )->shouldHaveKeyWithValue ('Content-Type ' , 'application/json ' );
34
37
}
35
38
36
39
function it_should_have_passed_in_config_params_instead_of_defaults ()
37
40
{
38
- $ this ->beConstructedThrough ( ' getClient ' , ['client-id ' , [ ' base_uri ' => 'https://different.url ' ] ]);
39
- $ this ->shouldHaveType ('\GuzzleHttp\Client ' );
41
+ $ this ->beConstructedWith ( ' TEST_CLIENT_ID ' , ['base_uri ' => 'https://different.url ' ]);
42
+ $ this ->shouldHaveType ('\NewTwitchApi\HelixGuzzleClient ' );
40
43
$ this ->getConfig ('base_uri ' )->getHost ()->shouldBe ('different.url ' );
41
44
}
42
45
}
0 commit comments