28
28
use Exchanger \Service \Xignite ;
29
29
use Exchanger \Service \RussianCentralBank ;
30
30
use Exchanger \Service \XchangeApi ;
31
+ use Http \Discovery \NotFoundException ;
31
32
use Http \Mock \Client ;
32
33
use PHPUnit \Framework \TestCase ;
33
34
use Swap \Service \Factory ;
@@ -62,7 +63,7 @@ public function servicesProvider()
62
63
['xignite ' , Xignite::class, ['token ' => 'token ' ]],
63
64
['russian_central_bank ' , RussianCentralBank::class],
64
65
['cryptonator ' , Cryptonator::class],
65
- ['xchangeapi ' , XchangeApi::class, ['api-key ' => 'api-key ' ]]
66
+ ['xchangeapi ' , XchangeApi::class, ['api-key ' => 'api-key ' ]],
66
67
];
67
68
}
68
69
@@ -87,30 +88,30 @@ public function testCustomServices()
87
88
$ this ->assertSame ($ service , $ factory ->create ('baz ' ));
88
89
}
89
90
90
- /**
91
- * @expectedException \LogicException
92
- * @expectedExceptionMessage Client must be an instance of Http\Client\HttpClient or Psr\Http\Client\ClientInterface
93
- */
94
91
public function testConstructInvalidClient ()
95
92
{
93
+ $ this ->expectException (\LogicException::class);
94
+ $ expectedExceptionMessage = 'Client must be an instance of Http\Client\HttpClient or Psr\Http\Client\ClientInterface ' ;
95
+ $ this ->expectExceptionMessage ($ expectedExceptionMessage );
96
+
96
97
$ factory = new Factory (new \stdClass ());
97
98
}
98
99
99
- /**
100
- * @expectedException \Http\Discovery\NotFoundException
101
- * @expectedExceptionMessage No HTTPlug clients found. Make sure to install a package providing "php-http/client-implementation"
102
- */
103
100
public function testWithNullAsClient ()
104
101
{
102
+ $ this ->expectException (NotFoundException::class);
103
+ $ expectedExceptionMessage = 'No HTTPlug clients found. Make sure to install a package providing "php-http/client-implementation" ' ;
104
+ $ this ->expectExceptionMessage ($ expectedExceptionMessage );
105
+
105
106
$ factory = new Factory ();
106
107
}
107
108
108
- /**
109
- * @expectedException \LogicException
110
- * @expectedExceptionMessage Client must be an instance of Http\Client\HttpClient or Psr\Http\Client\ClientInterface
111
- */
112
109
public function testSetInvalidClient ()
113
110
{
111
+ $ this ->expectException (\LogicException::class);
112
+ $ expectedExceptionMessage = 'Client must be an instance of Http\Client\HttpClient or Psr\Http\Client\ClientInterface ' ;
113
+ $ this ->expectExceptionMessage ($ expectedExceptionMessage );
114
+
114
115
$ factory = new Factory (new Client ());
115
116
$ factory ->setHttpClient (new \stdClass ());
116
117
}
0 commit comments