Skip to content

Commit 0bcdeb2

Browse files
authored
Update RestMultiClientTest.php
Added test for set/getMaxHandles. Cleaned up @Covers annotations to give proper code coverage results.
1 parent 90626c1 commit 0bcdeb2

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

tests/RestMultiClientTest.php

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,18 @@ protected function tearDown() {
124124
$this->client = null;
125125
}
126126

127+
public function notZeroOrPositiveIntegerProvider() {
128+
return array(
129+
array(-1),
130+
array(null),
131+
array(''),
132+
array(new \stdClass()),
133+
array(1.0),
134+
array('1'),
135+
array(array())
136+
);
137+
}
138+
127139
/**
128140
* @expectedException \InvalidArgumentException
129141
* @covers MikeBrant\RestClientLib\RestMultiClient::validateActionArray
@@ -230,8 +242,8 @@ public function testPostThrowsExceptionOnArraySizeMismatch() {
230242

231243
/**
232244
* @covers MikeBrant\RestClientLib\RestMultiClient::post
233-
* @covers MikeBrant\RestClientLib\RestMultiClient::validateData
234-
* @covers MikeBrant\RestClientLib\RestMultiClient::setRequestData
245+
* @covers MikeBrant\RestClientLib\RestMultiClient::validateDataArray
246+
* @covers MikeBrant\RestClientLib\RestMultiClient::setRequestDataArray
235247
*/
236248
public function testPost() {
237249
self::$curlMultiExecResponse = $this->curlMultiExecCompleteResponse;
@@ -299,4 +311,22 @@ public function testHead() {
299311
$this->assertInstanceOf(CurlMultiHttpResponse::class, $response);
300312
$this->assertAttributeEquals(null, 'curlMultiHandle', $this->client);
301313
}
314+
315+
/**
316+
* @dataProvider notZeroOrPositiveIntegerProvider
317+
* @expectedException \InvalidArgumentException
318+
* @covers MikeBrant\RestClientLib\RestMultiClient::setMaxHandles
319+
*/
320+
public function testSetMaxHandlesThrowsException($maxHandles) {
321+
$this->client->setMaxHandles($maxHandles);
322+
}
323+
324+
/**
325+
* @covers MikeBrant\RestClientLib\RestMultiClient::setMaxHandles
326+
* @covers MikeBrant\RestClientLib\RestMultiClient::getMaxHandles
327+
*/
328+
public function testSetMaxHandles() {
329+
$this->client->setMaxHandles(5);
330+
$this->assertEquals(5, $this->client->getMaxHandles());
331+
}
302332
}

0 commit comments

Comments
 (0)