Code Duplication    Length = 12-14 lines in 11 locations

application/tests/models/Sites_Model_test.php 11 locations

@@ 40-53 (lines=14) @@
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('4271:--: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('Tsugumomo', $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
@@ 78-91 (lines=14) @@
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
@@ 14-25 (lines=12) @@
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');
@@ 27-38 (lines=12) @@
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.');
@@ 54-65 (lines=12) @@
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
@@ 66-77 (lines=12) @@
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
@@ 92-103 (lines=12) @@
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
@@ 120-131 (lines=12) @@
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
@@ 132-145 (lines=14) @@
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
@@ 146-157 (lines=12) @@
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
@@ 158-169 (lines=12) @@
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
}
171