Skip to content

Commit 0a237be

Browse files
committed
Updated tests
1 parent 067980d commit 0a237be

File tree

5 files changed

+14
-328
lines changed

5 files changed

+14
-328
lines changed

tests/DomTest.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,6 @@ public function testGetElementsByClass()
259259
$this->assertEquals('<p>Hey bro, <a href="google.com" id="78">click here</a></p>', $dom->getElementsByClass('all')[0]->innerHtml);
260260
}
261261

262-
public function testEnforceEncoding()
263-
{
264-
$dom = new Dom;
265-
$dom->load('tests/files/horrible.html', [
266-
'enforceEncoding' => 'UTF-8',
267-
]);
268-
$this->assertNotEquals('<input type="submit" tabindex="0" name="submit" value="Информации" />', $dom->find('table input', 1)->outerHtml);
269-
}
270-
271262
public function testScriptCleanerScriptTag()
272263
{
273264
$dom = new Dom;

tests/Options/CleanupTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public function testCleanupInputTrue()
1010
$dom->setOptions([
1111
'cleanupInput' => true,
1212
]);
13-
$dom->loadFromFile('tests/files/horrible.html');
13+
$dom->loadFromFile('tests/files/big.html');
1414
$this->assertEquals(0, count($dom->find('style')));
1515
$this->assertEquals(0, count($dom->find('script')));
1616
}
@@ -21,9 +21,9 @@ public function testCleanupInputFalse()
2121
$dom->setOptions([
2222
'cleanupInput' => false,
2323
]);
24-
$dom->loadFromFile('tests/files/horrible.html');
24+
$dom->loadFromFile('tests/files/big.html');
2525
$this->assertEquals(1, count($dom->find('style')));
26-
$this->assertEquals(1, count($dom->find('script')));
26+
$this->assertEquals(22, count($dom->find('script')));
2727
}
2828

2929
public function testRemoveStylesTrue()
@@ -32,7 +32,7 @@ public function testRemoveStylesTrue()
3232
$dom->setOptions([
3333
'removeStyles' => true,
3434
]);
35-
$dom->loadFromFile('tests/files/horrible.html');
35+
$dom->loadFromFile('tests/files/big.html');
3636
$this->assertEquals(0, count($dom->find('style')));
3737
}
3838

@@ -42,7 +42,7 @@ public function testRemoveStylesFalse()
4242
$dom->setOptions([
4343
'removeStyles' => false,
4444
]);
45-
$dom->loadFromFile('tests/files/horrible.html');
45+
$dom->loadFromFile('tests/files/big.html');
4646
$this->assertEquals(1, count($dom->find('style')));
4747
$this->assertEquals('text/css',
4848
$dom->find('style')->getAttribute('type'));
@@ -54,7 +54,7 @@ public function testRemoveScriptsTrue()
5454
$dom->setOptions([
5555
'removeScripts' => true,
5656
]);
57-
$dom->loadFromFile('tests/files/horrible.html');
57+
$dom->loadFromFile('tests/files/big.html');
5858
$this->assertEquals(0, count($dom->find('script')));
5959
}
6060

@@ -64,9 +64,9 @@ public function testRemoveScriptsFalse()
6464
$dom->setOptions([
6565
'removeScripts' => false,
6666
]);
67-
$dom->loadFromFile('tests/files/horrible.html');
68-
$this->assertEquals(1, count($dom->find('script')));
69-
$this->assertEquals('text/JavaScript',
67+
$dom->loadFromFile('tests/files/big.html');
68+
$this->assertEquals(22, count($dom->find('script')));
69+
$this->assertEquals('text/javascript',
7070
$dom->find('script')->getAttribute('type'));
7171
}
7272

tests/StaticDomTest.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ public function testLoadFromFile()
4141
$this->assertEquals('VonBurgermeister', $dom->find('.post-user font', 0)->text);
4242
}
4343

44-
public function testFind()
45-
{
46-
Dom::load('tests/files/horrible.html');
47-
$this->assertEquals('<input type="submit" tabindex="0" name="submit" value="Информации" />', Dom::find('table input', 1)->outerHtml);
48-
}
49-
5044
/**
5145
* @expectedException PHPHtmlParser\Exceptions\NotLoadedException
5246
*/
@@ -57,8 +51,8 @@ public function testFindNoLoad()
5751

5852
public function testFindI()
5953
{
60-
Dom::load('tests/files/horrible.html');
61-
$this->assertEquals('[ Досие бр:12928 ]', Dom::find('i')[0]->innerHtml);
54+
Dom::load('tests/files/big.html');
55+
$this->assertEquals('В кустах блестит металл<br /> И искрится ток<br /> Человечеству конец', Dom::find('i')[1]->innerHtml);
6256
}
6357

6458
public function testLoadFromUrl()

tests/files/big.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848
<script type="text/javascript" src="http://riot-web-static.s3.amazonaws.com/forum/community_v2/js/jquery.cookie.js"></script>
4949
<script type="text/javascript" src="http://riot-web-static.s3.amazonaws.com/forum/community_v2/js/jquery.stm.js"></script>
5050

51-
51+
<style type="text/css">
52+
#id {some css}
53+
</style>
5254

5355
<script>
5456
$(document).ready(function(){

0 commit comments

Comments
 (0)