Completed
Pull Request — master (#30)
by
unknown
05:39
created

testIfInvalidIpisGiven()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 15
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
namespace Azine\MailgunWebhooksBundle\Tests\Services\HetrixtoolsService;
3
4
5
use Azine\MailgunWebhooksBundle\Services\HetrixtoolsService\AzineMailgunHetrixtoolsService;
6
use Azine\MailgunWebhooksBundle\Services\HetrixtoolsService\HetrixtoolsServiceResponse;
7
8
class AzineMailgunHetrixtoolsServiceTest extends \PHPUnit_Framework_TestCase
9
{
10
    /**
11
     * @expectedException \InvalidArgumentException
12
     */
13
    public function testIfApiKeyisNotSet()
14
    {
15
        $apiKey = '';
16
        $url = 'blacklistIpCheckUr';
17
18
        $ip = '44.44.44.44';
19
        $service = new AzineMailgunHetrixtoolsService($apiKey, $url);
20
        $service->checkIpAddressInBlacklist($ip);
21
    }
22
23
    /**
24
     * @expectedException \InvalidArgumentException
25
     */
26
    public function testIfInvalidIpisGiven()
27
    {
28
        $apiKey = 'testApiKey';
29
        $url = 'blacklistIpCheckUr';
30
31
        //Test with empty ip
32
        $ip = '';
33
        $service = new AzineMailgunHetrixtoolsService($apiKey, $url);
34
        $service->checkIpAddressInBlacklist($ip);
35
36
        //Test with invalid ip
37
38
        $ip = 'invalidIpAddress';
39
        $service->checkIpAddressInBlacklist($ip);
40
    }
41
}