RequestTest   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 3
Bugs 2 Features 0
Metric Value
wmc 8
c 3
b 2
f 0
lcom 1
cbo 2
dl 0
loc 50
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A testInvalidDomain() 0 5 1
A testInvalidApp() 0 5 1
A testInvalidAppStore() 0 5 1
A testInvalidStart() 0 5 1
A testInvalidEnd() 0 5 1
A testInvalidPeriod() 0 5 1
A testInvalidPage() 0 5 1
A testInvalidArg() 0 5 1
1
<?php
2
namespace Thunder\SimilarWebApi\Tests;
3
4
use Thunder\SimilarWebApi\Request\KeywordsOrganicSearch;
5
use Thunder\SimilarWebApi\Request\MobileApp;
6
use Thunder\SimilarWebApi\Request\Traffic;
7
use Thunder\SimilarWebApi\Request\TrafficPro;
8
use Thunder\SimilarWebApi\Tests\Dummy\SampleRequest;
9
10
/**
11
 * @author Tomasz Kowalczyk <[email protected]>
12
 */
13
class RequestTest extends \PHPUnit_Framework_TestCase
14
    {
15
    public function testInvalidDomain()
16
        {
17
        $this->setExpectedException('InvalidArgumentException');
18
        new Traffic('');
19
        }
20
21
    public function testInvalidApp()
22
        {
23
        $this->setExpectedException('InvalidArgumentException');
24
        new MobileApp(0, '');
25
        }
26
27
    public function testInvalidAppStore()
28
        {
29
        $this->setExpectedException('InvalidArgumentException');
30
        new MobileApp('invalid', 'app.id');
31
        }
32
33
    public function testInvalidStart()
34
        {
35
        $this->setExpectedException('InvalidArgumentException');
36
        new TrafficPro('example.com', 'weekly', 'invalid', '10-2014', true);
37
        }
38
39
    public function testInvalidEnd()
40
        {
41
        $this->setExpectedException('InvalidArgumentException');
42
        new TrafficPro('example.com', 'weekly', '09-2014', 'invalid', true);
43
        }
44
45
    public function testInvalidPeriod()
46
        {
47
        $this->setExpectedException('InvalidArgumentException');
48
        new TrafficPro('example.com', 'invalid', '09-2014', '10-2014', true);
49
        }
50
51
    public function testInvalidPage()
52
        {
53
        $this->setExpectedException('InvalidArgumentException');
54
        new KeywordsOrganicSearch('example.com', '09-2014', '10-2014', true, 'invalid');
55
        }
56
57
    public function testInvalidArg()
58
        {
59
        $this->setExpectedException('InvalidArgumentException');
60
        new SampleRequest();
61
        }
62
    }
63