-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
45 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace CommonsBundleTests\Unit\Transport\Udp; | ||
|
||
use CommonsBundleTests\KernelTestCaseAbstract; | ||
use Exception; | ||
use Hanaboso\CommonsBundle\Transport\Udp\UDPSender; | ||
use Hanaboso\PhpCheckUtils\PhpUnit\Traits\PrivateTrait; | ||
use phpmock\phpunit\PHPMock; | ||
|
||
/** | ||
* Class UdpSender2Test | ||
* | ||
* @package CommonsBundleTests\Unit\Transport\Udp | ||
*/ | ||
final class UdpSender2Test extends KernelTestCaseAbstract | ||
{ | ||
|
||
use PHPMock; | ||
use PrivateTrait; | ||
|
||
/** | ||
* @covers \Hanaboso\CommonsBundle\Transport\Udp\UDPSender::send | ||
* | ||
* @throws Exception | ||
*/ | ||
public function testSendErr(): void | ||
{ | ||
$message = 'abc,name=def,host=ghi key1=val1,key2=val2 1465839830100400200'; | ||
|
||
$this->getFunctionMock('Hanaboso\CommonsBundle\Transport\Udp', 'socket_last_error') | ||
->expects(self::any()) | ||
->willReturn(5); | ||
|
||
$this->getFunctionMock('Hanaboso\CommonsBundle\Transport\Udp', 'socket_sendto') | ||
->expects(self::any()) | ||
->willReturn(FALSE); | ||
|
||
$sender = new UDPSender(); | ||
$result = $sender->send('influxdb:61999', $message); | ||
self::assertFalse($result); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters