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
|
|
|
|