Completed
Push — master ( 1db464...628a7d )
by Angus
02:54
created

Site_Model_test::test_SenseScans()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 12
loc 12
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
class Site_Model_test extends TestCase {
4
	private $Sites_Model;
5
6
	public function setUp() {
7
		$this->resetInstance();
8
9
		$this->Sites_Model = new Sites_Model();
10
	}
11
12
	//TODO: Each test should check a randomized series each time instead of using the same series.
13
14
	public function test_MangaFox() {
15
		$result = $this->Sites_Model->{'MangaFox'}->getTitleData('tsugumomo');
16
17
		$this->assertInternalType('array', $result);
18
		$this->assertArrayHasKey('title', $result);
19
		$this->assertArrayHasKey('latest_chapter', $result);
20
		$this->assertArrayHasKey('last_updated', $result);
21
22
		$this->assertEquals('Tsugumomo', $result['title']);
23
		$this->assertRegExp('/^[c|v][0-9\.]+(?:\/c[0-9\.]+)?$/', $result['latest_chapter']);
24
		$this->assertRegExp('/^[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+$/', $result['last_updated']);
25
	}
26
27
	public function test_MangaHere() {
28
		$result = $this->Sites_Model->{'MangaHere'}->getTitleData('tsugumomo');
29
30
		$this->assertInternalType('array', $result);
31
		$this->assertArrayHasKey('title', $result);
32
		$this->assertArrayHasKey('latest_chapter', $result);
33
		$this->assertArrayHasKey('last_updated', $result);
34
35
		$this->assertEquals('Tsugumomo', $result['title']);
36
		$this->assertRegExp('/^[c|v][0-9\.]+(?:\/c[0-9\.]+)?$/', $result['latest_chapter']);
37
		$this->assertRegExp('/^[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+$/', $result['last_updated']);
38
	}
39
40
	public function test_Batoto() {
41
		$this->skipTravis('Missing required cookies.');
42
43
		$result = $this->Sites_Model->{'Batoto'}->getTitleData('17709:--:English');
44
45
		$this->assertInternalType('array', $result);
46
		$this->assertArrayHasKey('title', $result);
47
		$this->assertArrayHasKey('latest_chapter', $result);
48
		$this->assertArrayHasKey('last_updated', $result);
49
50
		$this->assertEquals('Kumo desu ga, nani ka?', $result['title']);
51
		$this->assertRegExp('/^[a-zA-Z0-9]+:--:[c|v][0-9\.\-]+(?:\/c[0-9\.\-]+)?$/', $result['latest_chapter']);
52
		$this->assertRegExp('/^[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+$/', $result['last_updated']);
53
	}
54
	public function test_DynastyScans() {
55
		$result = $this->Sites_Model->{'DynastyScans'}->getTitleData('qualia_the_purple:--:0');
56
57
		$this->assertInternalType('array', $result);
58
		$this->assertArrayHasKey('title', $result);
59
		$this->assertArrayHasKey('latest_chapter', $result);
60
		$this->assertArrayHasKey('last_updated', $result);
61
62
		$this->assertEquals('Qualia the Purple', $result['title']);
63
		$this->assertRegExp('/^ch(?:apters)?[0-9]+(?:_[0-9]+)?$/', $result['latest_chapter']);
64
		$this->assertRegExp('/^[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+$/', $result['last_updated']);
65
	}
66
	public function test_MangaPanda() {
67
		$result = $this->Sites_Model->{'MangaPanda'}->getTitleData('relife');
68
69
		$this->assertInternalType('array', $result);
70
		$this->assertArrayHasKey('title', $result);
71
		$this->assertArrayHasKey('latest_chapter', $result);
72
		$this->assertArrayHasKey('last_updated', $result);
73
74
		$this->assertEquals('ReLIFE', $result['title']);
75
		$this->assertRegExp('/^[0-9]+$/', $result['latest_chapter']);
76
		$this->assertRegExp('/^[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+$/', $result['last_updated']);
77
	}
78
	public function test_MangaStream() {
79
		$this->skipTravis('Travis\'s PHP Curl ver. doesn\'t seem to play nice with SSL.');
80
81
		$result = $this->Sites_Model->{'MangaStream'}->getTitleData('okitegami');
82
83
		$this->assertInternalType('array', $result);
84
		$this->assertArrayHasKey('title', $result);
85
		$this->assertArrayHasKey('latest_chapter', $result);
86
		$this->assertArrayHasKey('last_updated', $result);
87
88
		$this->assertEquals('The Memorandum of Kyoko Okitegami', $result['title']);
89
		$this->assertRegExp('/^.*?\/[0-9]+$/', $result['latest_chapter']);
90
		$this->assertRegExp('/^[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+$/', $result['last_updated']);
91
	}
92
	public function test_WebToons() {
93
		$result = $this->Sites_Model->{'WebToons'}->getTitleData('93:--:en:--:girls-of-the-wilds:--:action');
94
95
		$this->assertInternalType('array', $result);
96
		$this->assertArrayHasKey('title', $result);
97
		$this->assertArrayHasKey('latest_chapter', $result);
98
		$this->assertArrayHasKey('last_updated', $result);
99
100
		$this->assertEquals('Girls of the Wild\'s', $result['title']);
101
		$this->assertRegExp('/^.*?$/', $result['latest_chapter']);
102
		$this->assertRegExp('/^[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+$/', $result['last_updated']);
103
	}
104
	public function test_KissManga() {
105
		$this->markTestSkipped('KM is not supported for the time being');
106
107
		//$this->skipTravis('Missing required cookies.');
108
		//
109
		//$result = $this->Sites_Model->{'KissManga'}->getTitleData('Tsugumomo');
110
		//
111
		//$this->assertInternalType('array', $result);
112
		//$this->assertArrayHasKey('title', $result);
113
		//$this->assertArrayHasKey('latest_chapter', $result);
114
		//$this->assertArrayHasKey('last_updated', $result);
115
		//
116
		//$this->assertEquals('Tsugumomo', $result['title']);
117
		//$this->assertRegExp('/^.*?:--:[0-9]+$/', $result['latest_chapter']);
118
		//$this->assertRegExp('/^[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+$/', $result['last_updated']);
119
	}
120
	public function test_KireiCake() {
121
		$result = $this->Sites_Model->{'KireiCake'}->getTitleData('helck');
122
123
		$this->assertInternalType('array', $result);
124
		$this->assertArrayHasKey('title', $result);
125
		$this->assertArrayHasKey('latest_chapter', $result);
126
		$this->assertArrayHasKey('last_updated', $result);
127
128
		$this->assertEquals('helck', $result['title']);
129
		$this->assertRegExp('/^[a-z]+\/[0-9]+\/[0-9]+(?:\/[0-9]+)?$/', $result['latest_chapter']);
130
		$this->assertRegExp('/^[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+$/', $result['last_updated']);
131
	}
132
	public function test_GameOfScanlation() {
133
		$this->skipTravis('Travis\'s PHP Curl ver. doesn\'t seem to play nice with SSL.');
134
135
		$result = $this->Sites_Model->{'GameOfScanlation'}->getTitleData('legendary-moonlight-sculptor.99');
136
137
		$this->assertInternalType('array', $result);
138
		$this->assertArrayHasKey('title', $result);
139
		$this->assertArrayHasKey('latest_chapter', $result);
140
		$this->assertArrayHasKey('last_updated', $result);
141
142
		$this->assertEquals('Legendary Moonlight Sculptor', $result['title']);
143
		$this->assertRegExp('/^[a-z0-9\.-]+$/', $result['latest_chapter']);
144
		$this->assertRegExp('/^[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+$/', $result['last_updated']);
145
	}
146
	public function test_MangaCow() {
147
		$result = $this->Sites_Model->{'MangaCow'}->getTitleData('The_scholars_reincarnation');
148
149
		$this->assertInternalType('array', $result);
150
		$this->assertArrayHasKey('title', $result);
151
		$this->assertArrayHasKey('latest_chapter', $result);
152
		$this->assertArrayHasKey('last_updated', $result);
153
154
		$this->assertEquals('The Scholar\'s Reincarnation', $result['title']);
155
		$this->assertRegExp('/^[0-9]+$/', $result['latest_chapter']);
156
		$this->assertRegExp('/^[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+$/', $result['last_updated']);
157
	}
158
	public function test_SeaOtterScans() {
159
		$result = $this->Sites_Model->{'SeaOtterScans'}->getTitleData('marry_me');
160
161
		$this->assertInternalType('array', $result);
162
		$this->assertArrayHasKey('title', $result);
163
		$this->assertArrayHasKey('latest_chapter', $result);
164
		$this->assertArrayHasKey('last_updated', $result);
165
166
		$this->assertEquals('Marry Me!', $result['title']);
167
		$this->assertRegExp('/^[a-z]+\/[0-9]+\/[0-9]+(?:\/[0-9]+)?$/', $result['latest_chapter']);
168
		$this->assertRegExp('/^[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+$/', $result['last_updated']);
169
	}
170
	public function test_HelveticaScans() {
171
		$result = $this->Sites_Model->{'HelveticaScans'}->getTitleData('mousou-telepathy');
172
173
		$this->assertInternalType('array', $result);
174
		$this->assertArrayHasKey('title', $result);
175
		$this->assertArrayHasKey('latest_chapter', $result);
176
		$this->assertArrayHasKey('last_updated', $result);
177
178
		$this->assertEquals('Mousou Telepathy', $result['title']);
179
		$this->assertRegExp('/^[a-z]+\/[0-9]+\/[0-9]+(?:\/[0-9]+)?$/', $result['latest_chapter']);
180
		$this->assertRegExp('/^[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+$/', $result['last_updated']);
181
	}
182
	public function test_SenseScans() {
183
		$result = $this->Sites_Model->{'SenseScans'}->getTitleData('to_you_the_immortal');
184
185
		$this->assertInternalType('array', $result);
186
		$this->assertArrayHasKey('title', $result);
187
		$this->assertArrayHasKey('latest_chapter', $result);
188
		$this->assertArrayHasKey('last_updated', $result);
189
190
		$this->assertEquals('To You, The Immortal', $result['title']);
191
		$this->assertRegExp('/^[a-z]+\/[0-9]+\/[0-9]+(?:\/[0-9]+)?$/', $result['latest_chapter']);
192
		$this->assertRegExp('/^[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+$/', $result['last_updated']);
193
	}
194
}
195