GistShortCodeHandlerTest::testGistIdOnly()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %
Metric Value
dl 8
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
class GistShortCodeHandlerTest extends SapphireTest {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
5
	protected static $fixture_file = 'GistShortCodeHandlerTest.yml';
6
7 View Code Duplication
	public function testGistIdOnly() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
		$page = $this->objFromFixture('Page', 'GistIdOnly');
9
		$html = ShortcodeParser::get_active()->parse($page->Content);
10
		$expected = 'There should be a gist here <script src="https://gist.github.com/gordonbanderson/7fadc8280da9e2694960.js"></script><noscript>Please enable javascript to see this Gist inline.  It can be viewed externally here:
11
<a href="https://gist.github.com/gordonbanderson/7fadc8280da9e2694960">Gist</a></noscript>
12
';
13
		$this->assertEquals($expected, $html);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GistShortCodeHandlerTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
14
	}
15
16 View Code Duplication
	public function testGistWithCaption() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
		$page = $this->objFromFixture('Page', 'GistWithCaption');
18
		$html = ShortcodeParser::get_active()->parse($page->Content);
19
		$expected = 'There should be a gist here with a caption <script src="https://gist.github.com/gordonbanderson/7fadc8280da9e2694960.js"></script><noscript>Please enable javascript to see this Gist inline.  It can be viewed externally here:
20
<a href="https://gist.github.com/gordonbanderson/7fadc8280da9e2694960">Gist</a></noscript><p class="caption">This is a caption</p>
21
';
22
		$this->assertEquals($expected, $html);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GistShortCodeHandlerTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
23
	}
24
25
	public function testGistWithMissingID() {
26
		$page = $this->objFromFixture('Page', 'GistWithMissingID');
27
		$html = ShortcodeParser::get_active()->parse($page->Content);
28
		$this->assertEquals('This will be blank ', $html);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GistShortCodeHandlerTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
29
	}
30
31
}
32