1 | <?php |
||
49 | class ParserTest extends \PHPUnit_Framework_TestCase |
||
50 | { |
||
51 | /** |
||
52 | * Valid local test HTML document |
||
53 | * |
||
54 | * @var string |
||
55 | */ |
||
56 | const VALID_HTML_URL = 'http://localhost:1349/valid-test.html'; |
||
57 | /** |
||
58 | * Valid local test AMP HTML document with JSON-LD |
||
59 | * |
||
60 | * @var string |
||
61 | */ |
||
62 | const VALID_JSONLD_URL = 'http://localhost:1349/article-json-ld.amp.html'; |
||
63 | |||
64 | /** |
||
65 | * Test the LinkRel parser |
||
66 | */ |
||
67 | public function testLinkRelParser() |
||
74 | |||
75 | /** |
||
76 | * Test the JSON-LD parser |
||
77 | */ |
||
78 | public function testJsonLDParser() { |
||
83 | |||
84 | /** |
||
85 | * Test the parser facade |
||
86 | */ |
||
87 | // public function testParser() |
||
88 | // { |
||
89 | // $microformatsHtml = \ComposerLocator::getPath('microformats/test').DIRECTORY_SEPARATOR.'tests'. |
||
90 | // DIRECTORY_SEPARATOR.'microformats-v2'.DIRECTORY_SEPARATOR.'h-product'.DIRECTORY_SEPARATOR.'aggregate.html'; |
||
91 | // $parser = new Parser(Format::MICROFORMATS); |
||
92 | // $itemObjectModel = $parser(self::VALID_HTML_URL, file_get_contents($microformatsHtml), Format::ALL); |
||
93 | // $this->assertInstanceOf(ItemObjectModelInterface::class, $itemObjectModel); |
||
94 | // $this->assertEquals(1, count($itemObjectModel->getItems())); |
||
95 | // $item = $itemObjectModel->getFirstItem(); |
||
96 | // $this->assertInstanceOf(Item::class, $item); |
||
97 | //// $this->assertTrue($item->isOfType('invalid', MicroformatsFactory::MF2_PROFILE_URI.'h-product')); |
||
98 | // } |
||
99 | } |
||
100 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.