Completed
Branch master (9ef428)
by Christopher
03:56
created
src/Tests/_archive/document_types.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 			print var_dump($text);
22 22
 	}
23 23
 }
24
-require_once(__DIR__ . '/../../Dom/DOMDocumentWrapper.php');
24
+require_once(__DIR__.'/../../Dom/DOMDocumentWrapper.php');
25 25
 PhpQuery::$debug = 2;
26 26
 
27 27
 /* ENCODINGS */
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,9 @@
 block discarded – undo
17 17
 	static $documents = array();
18 18
 	static $defaultCharset = 'utf-8';
19 19
 	static function debug($text) {
20
-		if (self::$debug)
21
-			print var_dump($text);
20
+		if (self::$debug) {
21
+					print var_dump($text);
22
+		}
22 23
 	}
23 24
 }
24 25
 require_once(__DIR__ . '/../../Dom/DOMDocumentWrapper.php');
Please login to merge, or discard this patch.
src/Tests/_archive/test_5.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,14 +27,14 @@
 block discarded – undo
27 27
 	array('callbackClass', 'staticMethodCallback'),
28 28
 	array(new callbackClass, 'methodCallback')
29 29
 );
30
-foreach($tests as $test) {
30
+foreach ($tests as $test) {
31 31
 	$result = PhpQuery::newDocumentFile('test.html')
32 32
 		->find('li')
33 33
 			->each($test);
34 34
 	$testName = is_array($test)
35 35
 		? $test[1]
36 36
 		: $test;
37
-	if ( $result->whois() == $testResult )
37
+	if ($result->whois() == $testResult)
38 38
 		print "Test '$testName' PASSED :)";
39 39
 	else {
40 40
 		print "Test '$testName' <strong>FAILED</strong> !!! ";
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@
 block discarded – undo
34 34
 	$testName = is_array($test)
35 35
 		? $test[1]
36 36
 		: $test;
37
-	if ( $result->whois() == $testResult )
38
-		print "Test '$testName' PASSED :)";
39
-	else {
37
+	if ( $result->whois() == $testResult ) {
38
+			print "Test '$testName' PASSED :)";
39
+	} else {
40 40
 		print "Test '$testName' <strong>FAILED</strong> !!! ";
41 41
 		print "<pre>";
42 42
 		print_r($result->whois());
Please login to merge, or discard this patch.
src/Tests/_archive/test_4.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 $result = PhpQuery::newDocumentFile('test.html')
10 10
 	->find('li')
11 11
 		->slice(1, 2);
12
-if ( $result->whois() == $testResult )
12
+if ($result->whois() == $testResult)
13 13
 	print "Test 'Slice1' PASSED :)";
14 14
 else {
15 15
 	print "Test 'Slice1' <strong>FAILED</strong> !!! ";
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 $result = PhpQuery::newDocumentFile('test.html')
30 30
 	->find('li')
31 31
 		->slice(1, -1);
32
-if ( $result->whois() == $testResult )
32
+if ($result->whois() == $testResult)
33 33
 	print "Test 'Slice2' PASSED :)";
34 34
 else {
35 35
 	print "Test 'Slice2' <strong>FAILED</strong> !!! ";
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 		->php('longlongtest');
46 46
 $validResult = '<li><span class="field1"><php>longlongtest</php></span><span class="field1"><php>longlongtest</php></span></li>';
47 47
 similar_text($result->htmlOuter(), $validResult, $similarity);
48
-if ( $similarity > 80 )
48
+if ($similarity > 80)
49 49
 	print "Test 'Multi-insert' PASSED :)";
50 50
 else {
51 51
 	print "Test 'Multi-insert' <strong>FAILED</strong> !!! ";
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 $result = PhpQuery::newDocumentFile('test.html')
61 61
 	->find('p')
62 62
 		->index(pq('p.title:first'));
63
-if ( $result == $testResult )
63
+if ($result == $testResult)
64 64
 	print "Test 'Index' PASSED :)";
65 65
 else {
66 66
 	print "Test 'Index' <strong>FAILED</strong> !!! ";
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 $p = PhpQuery::newDocumentFile('test.html')
75 75
 	->toReference($document)
76 76
 	->find('p:first');
77
-foreach(array(0,1,2) as $i) {
77
+foreach (array(0, 1, 2) as $i) {
78 78
 	$p->clone()
79 79
 		->addClass("clone-test")
80 80
 		->addClass("class-$i")
Please login to merge, or discard this patch.
Braces   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
 $result = PhpQuery::newDocumentFile('test.html')
10 10
 	->find('li')
11 11
 		->slice(1, 2);
12
-if ( $result->whois() == $testResult )
12
+if ( $result->whois() == $testResult ) {
13 13
 	print "Test 'Slice1' PASSED :)";
14
-else {
14
+} else {
15 15
 	print "Test 'Slice1' <strong>FAILED</strong> !!! ";
16 16
 	print "<pre>";
17 17
 	print_r($result->whois());
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 $result = PhpQuery::newDocumentFile('test.html')
30 30
 	->find('li')
31 31
 		->slice(1, -1);
32
-if ( $result->whois() == $testResult )
32
+if ( $result->whois() == $testResult ) {
33 33
 	print "Test 'Slice2' PASSED :)";
34
-else {
34
+} else {
35 35
 	print "Test 'Slice2' <strong>FAILED</strong> !!! ";
36 36
 	print "<pre>";
37 37
 	print_r($result->whois());
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 		->php('longlongtest');
46 46
 $validResult = '<li><span class="field1"><php>longlongtest</php></span><span class="field1"><php>longlongtest</php></span></li>';
47 47
 similar_text($result->htmlOuter(), $validResult, $similarity);
48
-if ( $similarity > 80 )
48
+if ( $similarity > 80 ) {
49 49
 	print "Test 'Multi-insert' PASSED :)";
50
-else {
50
+} else {
51 51
 	print "Test 'Multi-insert' <strong>FAILED</strong> !!! ";
52 52
 	print "<pre>";
53 53
 	var_dump($result->htmlOuter());
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 $result = PhpQuery::newDocumentFile('test.html')
61 61
 	->find('p')
62 62
 		->index(pq('p.title:first'));
63
-if ( $result == $testResult )
63
+if ( $result == $testResult ) {
64 64
 	print "Test 'Index' PASSED :)";
65
-else {
65
+} else {
66 66
 	print "Test 'Index' <strong>FAILED</strong> !!! ";
67 67
 }
68 68
 print "\n";
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 		->addClass("class-$i")
81 81
 		->insertBefore($p);
82 82
 }
83
-if (pq('.clone-test')->size() == $testResult)
83
+if (pq('.clone-test')->size() == $testResult) {
84 84
 	print "Test '$testName' PASSED :)";
85
-else {
85
+} else {
86 86
 	print "Test '$testName' <strong>FAILED</strong> !!! ";
87 87
 }
88 88
 print "\n";
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 	->next()
98 98
 	->prev()
99 99
 	->is('#testID');
100
-if ($result)
100
+if ($result) {
101 101
 	print "Test '$testName' PASSED :)";
102
-else {
102
+} else {
103 103
 	print "Test '$testName' <strong>FAILED</strong> !!! ";
104 104
 }
105 105
 print "\n";
Please login to merge, or discard this patch.
src/Tests/_archive/test_arrayaccess.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@  discard block
 block discarded – undo
10 10
 $testHtml = PhpQuery::newDocumentFile('test.html');
11 11
 $testHtml['li:first']->append('<span class="just-added">test</span>');
12 12
 $testName = 'Array Access get';
13
-if (trim($testHtml['.just-added']->html()) == 'test')
13
+if (trim($testHtml['.just-added']->html()) == 'test') {
14 14
 	print "Test '$testName' PASSED :)";
15
-else {
15
+} else {
16 16
 	print "Test '$testName' <strong>FAILED</strong> !!! ";
17 17
 	print "<pre>";
18 18
 	print_r($testHtml['.just-added']->whois());
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
 $testHtml = PhpQuery::newDocumentFile('test.html');
26 26
 $testHtml['li:first'] = 'new inner html';
27 27
 $testName = 'Array Access set';
28
-if (trim($testHtml['li:first']->html()) == 'new inner html')
28
+if (trim($testHtml['li:first']->html()) == 'new inner html') {
29 29
 	print "Test '$testName' PASSED :)";
30
-else {
30
+} else {
31 31
 	print "Test '$testName' <strong>FAILED</strong> !!! ";
32 32
 	print "<pre>";
33 33
 	print_r($testHtml['.just-added']->whois());
Please login to merge, or discard this patch.
src/Tests/_archive/xpath.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@
 block discarded – undo
9 9
 whois($X->query($Query));
10 10
 function whois($nodeList) {
11 11
 	$return = array();
12
-	foreach( $nodeList as $node ) {
12
+	foreach ($nodeList as $node) {
13 13
 		$return[] = (
14 14
 			$node->tagName
15 15
 			.($node->getAttribute('id')
16
-				? '#'.$node->getAttribute('id'):'')
16
+				? '#'.$node->getAttribute('id') : '')
17 17
 			.($node->getAttribute('class')
18
-				? '.'.join('.', split(' ', $node->getAttribute('class'))):'')
18
+				? '.'.join('.', split(' ', $node->getAttribute('class'))) : '')
19 19
 		);
20 20
 	}
21 21
 	print "<pre>";
Please login to merge, or discard this patch.
src/Tests/_archive/test_insert.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@
 block discarded – undo
11 11
 print $doc->find('p');
12 12
 $markup = "test<br />test<p>test p</p>";
13 13
 $doc['body > p:last']->append($markup);
14
-if ($doc['body > p:last p']->length == 1)
14
+if ($doc['body > p:last p']->length == 1) {
15 15
 	print "Test '{$testName}' PASSED :)";
16
-else {
16
+} else {
17 17
 	print "Test '{$testName}' <strong>FAILED</strong> !!! ";
18 18
 	print $doc->htmlOuter('htmlspecialchars');
19 19
 }
Please login to merge, or discard this patch.
src/Tests/_archive/test_wrap.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
8 8
 		->slice(1, 3);
9 9
 $p->wrap('<div class="wrapper">');
10 10
 $result = true;
11
-foreach($p as $node) {
12
-	if (! pq($node)->parent()->is('.wrapper'))
11
+foreach ($p as $node) {
12
+	if (!pq($node)->parent()->is('.wrapper'))
13 13
 		$result = false;
14 14
 }
15 15
 if ($result)
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 		->slice(1, 3)
29 29
 			->wrapAll('<div class="wrapper">');
30 30
 $result = pq('.wrapper');
31
-if ( $result->size() == $testResult )
31
+if ($result->size() == $testResult)
32 32
 	print "Test '{$testName}' PASSED :)";
33 33
 else
34 34
 	print "Test '{$testName}' <strong>FAILED</strong> !!! ";
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	->find('li:first')
44 44
 		->wrapInner('<div class="wrapper">');
45 45
 $result = pq('.wrapper p');
46
-if ( $result->size() == $testResult )
46
+if ($result->size() == $testResult)
47 47
 	print "Test '{$testName}' PASSED :)";
48 48
 else
49 49
 	print "Test '{$testName}' <strong>FAILED</strong> !!! ";
Please login to merge, or discard this patch.
Braces   +13 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,13 +9,15 @@  discard block
 block discarded – undo
9 9
 $p->wrap('<div class="wrapper">');
10 10
 $result = true;
11 11
 foreach($p as $node) {
12
-	if (! pq($node)->parent()->is('.wrapper'))
13
-		$result = false;
14
-}
15
-if ($result)
12
+	if (! pq($node)->parent()->is('.wrapper')) {
13
+			$result = false;
14
+	}
15
+	}
16
+if ($result) {
16 17
 	print "Test '{$testName}' PASSED :)";
17
-else
18
+} else {
18 19
 	print "Test '{$testName}' <strong>FAILED</strong> !!! ";
20
+}
19 21
 $p->dump();
20 22
 print "\n";
21 23
 
@@ -28,10 +30,11 @@  discard block
 block discarded – undo
28 30
 		->slice(1, 3)
29 31
 			->wrapAll('<div class="wrapper">');
30 32
 $result = pq('.wrapper');
31
-if ( $result->size() == $testResult )
33
+if ( $result->size() == $testResult ) {
32 34
 	print "Test '{$testName}' PASSED :)";
33
-else
35
+} else {
34 36
 	print "Test '{$testName}' <strong>FAILED</strong> !!! ";
37
+}
35 38
 $result->dump();
36 39
 print "\n";
37 40
 
@@ -43,10 +46,11 @@  discard block
 block discarded – undo
43 46
 	->find('li:first')
44 47
 		->wrapInner('<div class="wrapper">');
45 48
 $result = pq('.wrapper p');
46
-if ( $result->size() == $testResult )
49
+if ( $result->size() == $testResult ) {
47 50
 	print "Test '{$testName}' PASSED :)";
48
-else
51
+} else {
49 52
 	print "Test '{$testName}' <strong>FAILED</strong> !!! ";
53
+}
50 54
 print $result->dump();
51 55
 print "\n";
52 56
 
Please login to merge, or discard this patch.
src/Tests/_archive/test_multidoc.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 foreach ($doc1->find('p') as $node)
13 13
    $doc2->find('body')->append(pq($node));
14 14
 $testResult = $doc2->find('p');
15
-if ( $testResult->size() == 2*$doc1->find('p')->size() )
15
+if ($testResult->size() == 2*$doc1->find('p')->size())
16 16
 	print "Test '{$testName}' PASSED :)";
17 17
 else {
18 18
 	print "Test '{$testName}' <strong>FAILED</strong> !!!<br />";
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 foreach ($doc1->find('p') as $node)
29 29
    $doc2->find('body')->append($node);
30 30
 $testResult = $doc2->find('p');
31
-if ( $testResult->size() == 2*$doc1->find('p')->size() )
31
+if ($testResult->size() == 2*$doc1->find('p')->size())
32 32
 	print "Test '{$testName}' PASSED :)";
33 33
 else {
34 34
 	print "Test '{$testName}' <strong>FAILED</strong> !!!<br />";
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,12 +9,13 @@  discard block
 block discarded – undo
9 9
 $doc1 = PhpQuery::newDocumentFile('test.html');
10 10
 $doc2 = PhpQuery::newDocumentFile('test.html');
11 11
 
12
-foreach ($doc1->find('p') as $node)
12
+foreach ($doc1->find('p') as $node) {
13 13
    $doc2->find('body')->append(pq($node));
14
+}
14 15
 $testResult = $doc2->find('p');
15
-if ( $testResult->size() == 2*$doc1->find('p')->size() )
16
+if ( $testResult->size() == 2*$doc1->find('p')->size() ) {
16 17
 	print "Test '{$testName}' PASSED :)";
17
-else {
18
+} else {
18 19
 	print "Test '{$testName}' <strong>FAILED</strong> !!!<br />";
19 20
 	$testResult->whois();
20 21
 }
@@ -25,12 +26,13 @@  discard block
 block discarded – undo
25 26
 );
26 27
 $doc1 = PhpQuery::newDocumentFile('test.html');
27 28
 $doc2 = PhpQuery::newDocumentFile('test.html');
28
-foreach ($doc1->find('p') as $node)
29
+foreach ($doc1->find('p') as $node) {
29 30
    $doc2->find('body')->append($node);
31
+}
30 32
 $testResult = $doc2->find('p');
31
-if ( $testResult->size() == 2*$doc1->find('p')->size() )
33
+if ( $testResult->size() == 2*$doc1->find('p')->size() ) {
32 34
 	print "Test '{$testName}' PASSED :)";
33
-else {
35
+} else {
34 36
 	print "Test '{$testName}' <strong>FAILED</strong> !!!<br />";
35 37
 	$testResult->whois();
36 38
 }
Please login to merge, or discard this patch.
src/Tests/_archive/test_selectors.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -274,11 +274,11 @@  discard block
 block discarded – undo
274 274
 );
275 275
 
276 276
 PhpQuery::newDocumentFile('test.html');
277
-foreach( $tests as $k => $test ) {
278
-	$tests[ $k ][2] = pq( $test[0] )->whois();
277
+foreach ($tests as $k => $test) {
278
+	$tests[$k][2] = pq($test[0])->whois();
279 279
 }
280
-foreach( $tests as $test ) {
281
-	if ( $test[1] == $test[2] )
280
+foreach ($tests as $test) {
281
+	if ($test[1] == $test[2])
282 282
 		print "Test '{$test[0]}' PASSED :)";
283 283
 	else {
284 284
 		print "Test '{$test[0]}' <strong>FAILED</strong> !!!";
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 pq('<select name="test[]"><option value=3>test</option></select>')
294 294
 	->appendTo('body');
295 295
 $result = pq('select[name="test[]"]:has(option[value=3])');
296
-if ( $result->size() == 1 )
296
+if ($result->size() == 1)
297 297
 	print "Test '{$testName}' PASSED :)";
298 298
 else
299 299
 	print "Test '{$testName}' <strong>FAILED</strong> !!! ";
Please login to merge, or discard this patch.
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -278,9 +278,9 @@  discard block
 block discarded – undo
278 278
 	$tests[ $k ][2] = pq( $test[0] )->whois();
279 279
 }
280 280
 foreach( $tests as $test ) {
281
-	if ( $test[1] == $test[2] )
282
-		print "Test '{$test[0]}' PASSED :)";
283
-	else {
281
+	if ( $test[1] == $test[2] ) {
282
+			print "Test '{$test[0]}' PASSED :)";
283
+	} else {
284 284
 		print "Test '{$test[0]}' <strong>FAILED</strong> !!!";
285 285
 		print_r($test[2]);
286 286
 	}
@@ -293,10 +293,11 @@  discard block
 block discarded – undo
293 293
 pq('<select name="test[]"><option value=3>test</option></select>')
294 294
 	->appendTo('body');
295 295
 $result = pq('select[name="test[]"]:has(option[value=3])');
296
-if ( $result->size() == 1 )
296
+if ( $result->size() == 1 ) {
297 297
 	print "Test '{$testName}' PASSED :)";
298
-else
298
+} else {
299 299
 	print "Test '{$testName}' <strong>FAILED</strong> !!! ";
300
+}
300 301
 $result->dump();
301 302
 print "\n";
302 303
 ?>
303 304
\ No newline at end of file
Please login to merge, or discard this patch.