|
@@ 64-75 (lines=12) @@
|
| 61 |
|
$this->azineMailgunService->expects($this->any())->method('sendBlacklistNotification')->will($this->returnvalue(1)); |
| 62 |
|
} |
| 63 |
|
|
| 64 |
|
public function testSendingBlackListReport() |
| 65 |
|
{ |
| 66 |
|
$tester = $this->getTester(); |
| 67 |
|
|
| 68 |
|
//test if response status is 'SUCCESS' and ip is blacklisted |
| 69 |
|
$this->hetrixtoolsService->expects($this->any())->method("checkIpAddressInBlacklist")->will($this->returnValue($this->hetrixtoolsRespose)); |
| 70 |
|
|
| 71 |
|
$tester->execute(array('')); |
| 72 |
|
|
| 73 |
|
$display = $tester->getDisplay(); |
| 74 |
|
$this->assertContains(CheckIpAddressIsBlacklistedCommand::BLACKLIST_REPORT_WAS_SENT, $display); |
| 75 |
|
} |
| 76 |
|
|
| 77 |
|
public function testNotSendingBlackListReport() |
| 78 |
|
{ |
|
@@ 77-91 (lines=15) @@
|
| 74 |
|
$this->assertContains(CheckIpAddressIsBlacklistedCommand::BLACKLIST_REPORT_WAS_SENT, $display); |
| 75 |
|
} |
| 76 |
|
|
| 77 |
|
public function testNotSendingBlackListReport() |
| 78 |
|
{ |
| 79 |
|
$tester = $this->getTester(); |
| 80 |
|
|
| 81 |
|
//test if response status is 'SUCCESS' and ip is blacklisted |
| 82 |
|
$this->hetrixtoolsService->expects($this->any())->method("checkIpAddressInBlacklist")->will($this->returnValue($this->hetrixtoolsRespose)); |
| 83 |
|
|
| 84 |
|
//test if response status is 'SUCCESS' but ip is not blacklisted |
| 85 |
|
$this->hetrixtoolsRespose->blacklisted_count = 0; |
| 86 |
|
|
| 87 |
|
$tester->execute(array('')); |
| 88 |
|
|
| 89 |
|
$display = $tester->getDisplay(); |
| 90 |
|
$this->assertContains(CheckIpAddressIsBlacklistedCommand::IP_IS_NOT_BLACKLISTED, $display); |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
public function testNoResponse() |
| 94 |
|
{ |
|
@@ 93-102 (lines=10) @@
|
| 90 |
|
$this->assertContains(CheckIpAddressIsBlacklistedCommand::IP_IS_NOT_BLACKLISTED, $display); |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
public function testNoResponse() |
| 94 |
|
{ |
| 95 |
|
$tester = $this->getTester(); |
| 96 |
|
$this->hetrixtoolsService->expects($this->once())->method("checkIpAddressInBlacklist")->will($this->throwException(new \InvalidArgumentException('no parseable response received.'))); |
| 97 |
|
|
| 98 |
|
$tester->execute(array('')); |
| 99 |
|
|
| 100 |
|
$display = $tester->getDisplay(); |
| 101 |
|
$this->assertContains(CheckIpAddressIsBlacklistedCommand::NO_RESPONSE_FROM_HETRIX, $display); |
| 102 |
|
} |
| 103 |
|
|
| 104 |
|
/** |
| 105 |
|
* @return CommandTester |