| @@ 250-264 (lines=15) @@ | ||
| 247 | $client->execute('aCommand'); |
|
| 248 | } |
|
| 249 | ||
| 250 | public function testWriteException() |
|
| 251 | { |
|
| 252 | $this->setExpectedException(TelnetExceptionInterface::class); |
|
| 253 | ||
| 254 | $client = m::mock(TelnetClient::class)->makePartial(); |
|
| 255 | ||
| 256 | $socket = m::mock(Socket::class) |
|
| 257 | ->shouldReceive('write') |
|
| 258 | ->andThrow(\Exception::class) |
|
| 259 | ->shouldReceive('close') |
|
| 260 | ->getMock(); |
|
| 261 | ||
| 262 | $client->setSocket($socket); |
|
| 263 | $client->execute('aCommand'); |
|
| 264 | } |
|
| 265 | ||
| 266 | public function testReadException() |
|
| 267 | { |
|
| @@ 266-281 (lines=16) @@ | ||
| 263 | $client->execute('aCommand'); |
|
| 264 | } |
|
| 265 | ||
| 266 | public function testReadException() |
|
| 267 | { |
|
| 268 | $this->setExpectedException(TelnetExceptionInterface::class); |
|
| 269 | ||
| 270 | $client = m::mock(TelnetClient::class)->makePartial(); |
|
| 271 | ||
| 272 | $socket = m::mock(Socket::class) |
|
| 273 | ->shouldReceive('write') |
|
| 274 | ->shouldReceive('close') |
|
| 275 | ->shouldReceive('read') |
|
| 276 | ->andThrow(\Exception::class) |
|
| 277 | ->getMock(); |
|
| 278 | ||
| 279 | $client->setSocket($socket); |
|
| 280 | $client->execute('aCommand'); |
|
| 281 | } |
|
| 282 | ||
| 283 | public function testFactory() |
|
| 284 | { |
|