44namespace ShellyClientTest \Model \Request ;
55
66use GuzzleHttp \Psr7 \Response ;
7- use PHPUnit \Framework \TestCase ;
8- use ShellyClient \HTTP \Client ;
9- use ShellyClient \HTTP \RequestService ;
107use ShellyClient \Model \Request \SettingsRequest ;
11- use ShellyClientTest \ Mock \ HTTP \ ClientMock ;
8+ use ShellyClient \ Model \ Response \ SettingsResponse ;
129
13- class SettingsRequestTest extends TestCase
10+ class SettingsRequestTest extends AbstractRequestTest
1411{
15- private static Client $ client ;
16-
17- private RequestService $ requestService ;
18-
19- public static function setUpBeforeClass (): void
20- {
21- self ::$ client = new ClientMock ('' );
22- }
23-
24- protected function setUp (): void
25- {
26- $ this ->requestService = $ this
27- ->getMockBuilder (RequestService::class)
28- ->setMethods (['getResponse ' , 'getRequest ' ])
29- ->setConstructorArgs ([self ::$ client ->getHttpClient (), self ::$ client ->getSerializer ()])
30- ->getMock ();
31- }
32-
3312 public function simpleDataProvider (): array
3413 {
3514 return [
@@ -54,12 +33,13 @@ public function testSimple(string $testFile, string $expectedType): void
5433 $ this ->requestService ->method ('getResponse ' )->willReturn ($ response );
5534 $ this ->requestService ->method ('getRequest ' )->willReturn (new SettingsRequest ());
5635
36+ /** @var SettingsResponse $settings */
5737 $ settings = $ this ->requestService ->getResponseSerialized ();
5838
5939 self ::assertSame ('PC ' , $ settings ->getName ());
6040 self ::assertSame ($ expectedType , $ settings ->getDevice ()->getType ());
6141
62- self ::assertIsArray ($ settings ->getRelays ());
42+ self ::assertNotEmpty ($ settings ->getRelays ());
6343 self ::assertCount ($ settings ->getDevice ()->getNumOutputs (), $ settings ->getRelays ());
6444 }
6545
0 commit comments