@@ 35-52 (lines=18) @@ | ||
32 | "Color" => "Color", |
|
33 | ]; |
|
34 | ||
35 | public function testSuccess() |
|
36 | { |
|
37 | /** @var RequestInterface $httpRequest */ |
|
38 | $httpRequest = $this->getMockForAbstractClass(RequestInterface::class); |
|
39 | $httpResponse = $this->getMockHttpResponse('GetClassifiersSuccess.txt'); |
|
40 | ||
41 | $response = new ClassifiersResponse($httpRequest, $httpResponse->getBody()); |
|
42 | ||
43 | $classifiers = $response->getClassifiers(); |
|
44 | ||
45 | $this->assertTrue($response->isSuccessful()); |
|
46 | $this->assertCount(14, $classifiers); |
|
47 | ||
48 | foreach ($classifiers as $classifier) { |
|
49 | $this->assertInstanceOf(Classifier::class, $classifier); |
|
50 | $this->assertContains($classifier->getName(), $this->classifiers); |
|
51 | } |
|
52 | } |
|
53 | ||
54 | /** |
|
55 | * Test versbose response |
|
@@ 57-75 (lines=19) @@ | ||
54 | /** |
|
55 | * Test versbose response |
|
56 | */ |
|
57 | public function testVerbose() |
|
58 | { |
|
59 | /** @var RequestInterface $httpRequest */ |
|
60 | $httpRequest = $this->getMockForAbstractClass(RequestInterface::class); |
|
61 | $httpResponse = $this->getMockHttpResponse('GetClassifiersVerbose.txt'); |
|
62 | ||
63 | $response = new ClassifiersResponse($httpRequest, $httpResponse->getBody()); |
|
64 | ||
65 | $classifiers = $response->getClassifiers(); |
|
66 | ||
67 | $this->assertTrue($response->isSuccessful()); |
|
68 | $this->assertCount(713, $classifiers); |
|
69 | ||
70 | foreach ($classifiers as $classifier) { |
|
71 | $this->assertInstanceOf(Classifier::class, $classifier); |
|
72 | $this->assertInstanceOf(\DateTime::class, $classifier->getCreated()); |
|
73 | $this->assertEquals('IBM', $classifier->getOwner()); |
|
74 | } |
|
75 | } |
|
76 | } |
|
77 |