@@ -31,10 +31,11 @@ class HTMLDocumentProtectorTest extends TestCase {
31
31
<body>
32
32
<h1>This HTML is for the unit test.</h1>
33
33
<p>Hello</p>
34
- <form method="POST">
35
- <input type="text">
36
- <button type="submit"></button>
37
- </form>
34
+
35
+ <form method="POST">
36
+ <input type="text">
37
+ <button type="submit"></button>
38
+ </form>
38
39
</body>
39
40
</html>
40
41
HTML ;
@@ -50,17 +51,16 @@ class HTMLDocumentProtectorTest extends TestCase {
50
51
<body>
51
52
<h1>This HTML is for the unit test.</h1>
52
53
<p>Hello</p>
53
- <form method="POST">
54
- <input type="text">
55
- <button type="submit"></button>
56
- </form>
57
- <form method="GET">
58
- <input type="text" value="A text field">
59
- <button type="submit"></button>
60
- </form>
61
- <!-- an empty form too...-->
62
- <form method="POST">
63
- </form>
54
+ <form method="POST">
55
+ <input type="text">
56
+ <button type="submit"></button>
57
+ </form>
58
+ <form method="GET">
59
+ <input type="text" value="A text field">
60
+ <button type="submit"></button>
61
+ </form>
62
+ <!-- an empty form too...-->
63
+ <form method="POST"></form>
64
64
</body>
65
65
</html>
66
66
HTML ;
@@ -77,9 +77,9 @@ class HTMLDocumentProtectorTest extends TestCase {
77
77
<body>
78
78
<h1>This HTML is for the unit test.</h1>
79
79
<p>Hello</p>
80
- <!-- an empty form too...-->
81
- <form method="POST">
82
- </form>
80
+ <!-- an empty form too...-->
81
+ <form method="POST">
82
+ </form>
83
83
</body>
84
84
</html>
85
85
HTML ;
@@ -153,12 +153,17 @@ public function testMultipleForms() {
153
153
154
154
// check that the token has been injected in all forms
155
155
$ doc = $ sut ->getHTMLDocument ();
156
- $ this ->assertEquals (
157
- 3 , $ doc ->querySelectorAll (
158
- "input[name=' " . HTMLDocumentProtector::TOKEN_NAME . "'] " )->length );
159
- $ this ->assertEquals (
160
- 1 , $ doc ->querySelectorAll (
161
- "head meta[name=' " . HTMLDocumentProtector::TOKEN_NAME . "'] " )->length );
156
+ $ this ->assertCount (
157
+ 2 ,
158
+ $ doc ->querySelectorAll (
159
+ "input[name=' " . HTMLDocumentProtector::TOKEN_NAME . "'] "
160
+ )
161
+ );
162
+ $ this ->assertCount (
163
+ 1 ,
164
+ $ doc ->querySelectorAll (
165
+ "head meta[name=' " . HTMLDocumentProtector::TOKEN_NAME . "'] " )
166
+ );
162
167
}
163
168
164
169
public function testSingleCodeSharedAcrossForms () {
0 commit comments