Skip to content

Commit 2f44523

Browse files
committed
Migrate PHPUnit syntax
1 parent c7842c8 commit 2f44523

File tree

6 files changed

+28
-38
lines changed

6 files changed

+28
-38
lines changed

tests/DocumentParsers/MarkdownDocumentParserTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function indents_are_not_treated_as_code_blocks()
3636

3737
$outputDoc = $parser->parse($doc);
3838

39-
$this->assertNotContains('<pre><code>', $outputDoc->content());
40-
$this->assertNotContains('</code></pre>', $outputDoc->content());
39+
$this->assertStringNotContainsString('<pre><code>', $outputDoc->content());
40+
$this->assertStringNotContainsString('</code></pre>', $outputDoc->content());
4141
}
4242
}

tests/FileSystemDocumentProviderTest.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,10 @@ public function can_get_document_that_is_numerically_ordered()
174174
$this->assertSame('01-building.md', $pattern2->content());
175175
}
176176

177-
/**
178-
* @test
179-
* @expectedException Rareloop\Primer\Exceptions\DocumentNotFoundException
180-
*/
177+
/** @test */
181178
public function getDocument_throws_exception_if_document_does_not_exist()
182179
{
180+
$this->expectException(\Rareloop\Primer\Exceptions\DocumentNotFoundException::class);
183181
vfsStream::setup();
184182
$root = vfsStream::create([
185183
'foo' => [
@@ -202,12 +200,11 @@ public function allDocumentIds_does_not_fall_over_if_no_paths_are_provided()
202200
$this->assertSame([], $dataProvider->allDocumentIds());
203201
}
204202

205-
/**
206-
* @test
207-
* @expectedException Rareloop\Primer\Exceptions\DocumentNotFoundException
208-
*/
203+
/** @test */
209204
public function getDocument_does_not_fall_over_if_no_paths_are_provided()
210205
{
206+
$this->expectException(\Rareloop\Primer\Exceptions\DocumentNotFoundException::class);
207+
211208
$dataProvider = new FileSystemDocumentProvider([], 'md');
212209

213210
$dataProvider->getDocument('not/found');

tests/FileSystemPatternProviderTest.php

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,11 @@ public function can_get_template_contents()
109109
$this->assertSame('<footer>Hello World</footer>', $dataProvider->getPatternTemplate('components/misc/footer'));
110110
}
111111

112-
/**
113-
* @test
114-
* @expectedException Rareloop\Primer\Exceptions\PatternNotFoundException
115-
*/
112+
/** @test */
116113
public function can_not_get_template_contents_if_partial_id_provided()
117114
{
115+
$this->expectException(\Rareloop\Primer\Exceptions\PatternNotFoundException::class);
116+
118117
vfsStream::setup();
119118
$root = vfsStream::create([
120119
'foo' => [
@@ -215,12 +214,11 @@ public function can_check_if_state_data_exists_for_a_pattern_as_php()
215214
$this->assertFalse($dataProvider->patternHasState('components/misc/header', 'unexpected'));
216215
}
217216

218-
/**
219-
* @test
220-
* @expectedException Rareloop\Primer\Exceptions\PatternNotFoundException
221-
*/
217+
/** @test */
222218
public function patternHasState_throws_exception_if_pattern_does_not_exist()
223219
{
220+
$this->expectException(\Rareloop\Primer\Exceptions\PatternNotFoundException::class);
221+
224222
vfsStream::setup();
225223
$root = vfsStream::create([
226224
'foo' => [
@@ -535,12 +533,11 @@ public function getPatternStateData_returns_empty_array_when_no_data_is_availabl
535533
$this->assertSame([], $data);
536534
}
537535

538-
/**
539-
* @test
540-
* @expectedException Rareloop\Primer\Exceptions\PatternNotFoundException
541-
*/
536+
/** @test */
542537
public function getPatternStateData_throws_exception_when_pattern_is_invalid()
543538
{
539+
$this->expectException(\Rareloop\Primer\Exceptions\PatternNotFoundException::class);
540+
544541
vfsStream::setup();
545542
$root = vfsStream::create([
546543
'foo' => [
@@ -592,12 +589,11 @@ public function getPatternStateData_does_not_fall_over_if_no_paths_are_provided(
592589
$this->assertSame([], $dataProvider->getPatternStateData('not/found', 'state'));
593590
}
594591

595-
/**
596-
* @test
597-
* @expectedException Rareloop\Primer\Exceptions\PatternNotFoundException
598-
*/
592+
/** @test */
599593
public function getPattern_does_not_fall_over_if_no_paths_are_provided()
600594
{
595+
$this->expectException(\Rareloop\Primer\Exceptions\PatternNotFoundException::class);
596+
601597
$dataProvider = new FileSystemPatternProvider([], 'md');
602598

603599
$dataProvider->getPattern('not/found');

tests/MenuTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,11 @@ public function can_test_if_a_section_exists()
5656
$this->assertFalse($menu->hasSection('templates'));
5757
}
5858

59-
/**
60-
* @test
61-
* @expectedException Rareloop\Primer\Exceptions\SectionNotFoundException
62-
*/
59+
/** @test */
6360
public function getSection_throws_an_exception_if_section_is_not_found()
6461
{
62+
$this->expectException(\Rareloop\Primer\Exceptions\SectionNotFoundException::class);
63+
6564
$menu = new Menu();
6665
$menu->getSection('patterns');
6766
}

tests/PrimerTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,11 @@ public function correct_patterns_are_rendered_when_one_name_is_contained_in_anot
355355
$this->assertSame('<p>Testing123</p>', $primer->renderPatterns('components/misc/header'));
356356
}
357357

358-
/**
359-
* @test
360-
* @expectedException Rareloop\Primer\Exceptions\PatternNotFoundException
361-
*/
358+
/** @test */
362359
public function renderPatterns_throws_exception_if_no_matching_patterns_are_found()
363360
{
361+
$this->expectException(\Rareloop\Primer\Exceptions\PatternNotFoundException::class);
362+
364363
$patternIds = [
365364
'components/misc/header',
366365
'components/misc/footer',

tests/TreeTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,11 @@ public function setCurrent_ignores_leading_and_trailing_slashes()
343343
], $tree->toArray());
344344
}
345345

346-
/**
347-
* @test
348-
* @expectedException Rareloop\Primer\Exceptions\TreeNodeNotFoundException
349-
*/
346+
/** @test */
350347
public function setCurrent_throws_exception_when_node_not_found()
351348
{
349+
$this->expectException(\Rareloop\Primer\Exceptions\TreeNodeNotFoundException::class);
350+
352351
$tree = new Tree([
353352
'components/misc/footer',
354353
'components/misc/header',

0 commit comments

Comments
 (0)