Skip to content

Commit 95f8d0c

Browse files
committed
Use relative file paths in tests
1 parent 50412a6 commit 95f8d0c

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

tests/DomTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,21 +147,21 @@ public function testLoadUpperCase()
147147
public function testLoadWithFile()
148148
{
149149
$dom = new Dom;
150-
$dom->loadFromFile('tests/files/small.html');
150+
$dom->loadFromFile(__DIR__ . '/files/small.html');
151151
$this->assertEquals('VonBurgermeister', $dom->find('.post-user font', 0)->text);
152152
}
153153

154154
public function testLoadFromFile()
155155
{
156156
$dom = new Dom;
157-
$dom->loadFromFile('tests/files/small.html');
157+
$dom->loadFromFile(__DIR__ . '/files/small.html');
158158
$this->assertEquals('VonBurgermeister', $dom->find('.post-user font', 0)->text);
159159
}
160160

161161
public function testLoadFromFileFind()
162162
{
163163
$dom = new Dom;
164-
$dom->loadFromFile('tests/files/small.html');
164+
$dom->loadFromFile(__DIR__ . '/files/small.html');
165165
$this->assertEquals('VonBurgermeister', $dom->find('.post-row div .post-user font', 0)->text);
166166
}
167167

@@ -175,22 +175,22 @@ public function testLoadUtf8()
175175
public function testLoadFileBig()
176176
{
177177
$dom = new Dom;
178-
$dom->loadFromFile('tests/files/big.html');
178+
$dom->loadFromFile(__DIR__ . '/files/big.html');
179179
$this->assertEquals(10, count($dom->find('.content-border')));
180180
}
181181

182182
public function testLoadFileBigTwice()
183183
{
184184
$dom = new Dom;
185-
$dom->loadFromFile('tests/files/big.html');
185+
$dom->loadFromFile(__DIR__ . '/files/big.html');
186186
$post = $dom->find('.post-row', 0);
187187
$this->assertEquals(' <p>Журчанье воды<br /> Черно-белые тени<br /> Вновь на фонтане</p> ', $post->find('.post-message', 0)->innerHtml);
188188
}
189189

190190
public function testLoadFileBigTwicePreserveOption()
191191
{
192192
$dom = new Dom;
193-
$dom->loadFromFile('tests/files/big.html', ['preserveLineBreaks' => true]);
193+
$dom->loadFromFile(__DIR__ . '/files/big.html', ['preserveLineBreaks' => true]);
194194
$post = $dom->find('.post-row', 0);
195195
$this->assertEquals('<p>Журчанье воды<br />
196196
Черно-белые тени<br />
@@ -203,7 +203,7 @@ public function testLoadFromUrl()
203203
$curl->shouldReceive('get')
204204
->once()
205205
->with('http://google.com')
206-
->andReturn(file_get_contents('tests/files/small.html'));
206+
->andReturn(file_get_contents(__DIR__ . '/files/small.html'));
207207

208208
$dom = new Dom;
209209
$dom->loadFromUrl('http://google.com', [], $curl);
@@ -262,7 +262,7 @@ public function testGetElementsByClass()
262262
public function testEnforceEncoding()
263263
{
264264
$dom = new Dom;
265-
$dom->load('tests/files/horrible.html', [
265+
$dom->load(__DIR__ . '/files/horrible.html', [
266266
'enforceEncoding' => 'UTF-8',
267267
]);
268268
$this->assertNotEquals('<input type="submit" tabindex="0" name="submit" value="Информации" />', $dom->find('table input', 1)->outerHtml);

tests/Options/CleanupTest.php

Lines changed: 6 additions & 6 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(__DIR__ . '/../files/horrible.html');
1414
$this->assertEquals(0, count($dom->find('style')));
1515
$this->assertEquals(0, count($dom->find('script')));
1616
}
@@ -21,7 +21,7 @@ public function testCleanupInputFalse()
2121
$dom->setOptions([
2222
'cleanupInput' => false,
2323
]);
24-
$dom->loadFromFile('tests/files/horrible.html');
24+
$dom->loadFromFile(__DIR__ . '/../files/horrible.html');
2525
$this->assertEquals(1, count($dom->find('style')));
2626
$this->assertEquals(1, count($dom->find('script')));
2727
}
@@ -32,7 +32,7 @@ public function testRemoveStylesTrue()
3232
$dom->setOptions([
3333
'removeStyles' => true,
3434
]);
35-
$dom->loadFromFile('tests/files/horrible.html');
35+
$dom->loadFromFile(__DIR__ . '/../files/horrible.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(__DIR__ . '/../files/horrible.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(__DIR__ . '/../files/horrible.html');
5858
$this->assertEquals(0, count($dom->find('script')));
5959
}
6060

@@ -64,7 +64,7 @@ public function testRemoveScriptsFalse()
6464
$dom->setOptions([
6565
'removeScripts' => false,
6666
]);
67-
$dom->loadFromFile('tests/files/horrible.html');
67+
$dom->loadFromFile(__DIR__ . '/../files/horrible.html');
6868
$this->assertEquals(1, count($dom->find('script')));
6969
$this->assertEquals('text/JavaScript',
7070
$dom->find('script')->getAttribute('type'));

tests/StaticDomTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ public function testLoad()
3131

3232
public function testLoadWithFile()
3333
{
34-
$dom = Dom::load('tests/files/small.html');
34+
$dom = Dom::load(__DIR__ . '/files/small.html');
3535
$this->assertEquals('VonBurgermeister', $dom->find('.post-user font', 0)->text);
3636
}
3737

3838
public function testLoadFromFile()
3939
{
40-
$dom = Dom::loadFromFile('tests/files/small.html');
40+
$dom = Dom::loadFromFile(__DIR__ . '/files/small.html');
4141
$this->assertEquals('VonBurgermeister', $dom->find('.post-user font', 0)->text);
4242
}
4343

4444
public function testFind()
4545
{
46-
Dom::load('tests/files/horrible.html');
46+
Dom::load(__DIR__ . '/files/horrible.html');
4747
$this->assertEquals('<input type="submit" tabindex="0" name="submit" value="Информации" />', Dom::find('table input', 1)->outerHtml);
4848
}
4949

@@ -57,7 +57,7 @@ public function testFindNoLoad()
5757

5858
public function testFindI()
5959
{
60-
Dom::load('tests/files/horrible.html');
60+
Dom::load(__DIR__ . '/files/horrible.html');
6161
$this->assertEquals('[ Досие бр:12928 ]', Dom::find('i')[0]->innerHtml);
6262
}
6363

@@ -67,7 +67,7 @@ public function testLoadFromUrl()
6767
$curl->shouldReceive('get')
6868
->once()
6969
->with('http://google.com')
70-
->andReturn(file_get_contents('tests/files/small.html'));
70+
->andReturn(file_get_contents(__DIR__ . '/files/small.html'));
7171

7272
Dom::loadFromUrl('http://google.com', [], $curl);
7373
$this->assertEquals('VonBurgermeister', Dom::find('.post-row div .post-user font', 0)->text);

0 commit comments

Comments
 (0)