/** * @covers \NewFrontiers\Framework\Output\Css::registerLibrary * @covers \NewFrontiers\Framework\Output\Css::requireLibrary * @covers \NewFrontiers\Framework\Output\Css::getLinkTags * @covers \NewFrontiers\Framework\Output\Css::includeLibraries */ public function testIncludeLibraries() { static::assertEquals('', Css::getLinkTags()); Css::registerLibrary('test1', ['test1.css', 'test2.css']); Css::registerLibrary('test2', 'test3.css'); $soll = "\n<link href=\"test1.css\" rel=\"stylesheet\" type=\"text/css\" />" . "\n<link href=\"test2.css\" rel=\"stylesheet\" type=\"text/css\" />" . "\n<link href=\"test3.css\" rel=\"stylesheet\" type=\"text/css\" />"; Css::requireLibrary('test1'); Css::requireLibrary('test2'); Css::requireLibrary('test3'); //this will create en error log static::assertEquals($soll, Css::getLinkTags()); //error log asserted here $items = Logging::getLogItems(); $msg = end($items)["msg"]; static::assertStringStartsWith("CSS-Bibliothek nicht gefunden: test3", $msg); //Logging actually puts \r\n at the end of the message //the following code depends on the previous code, that' s why it isn't a single test Css::registerLibrary(0, '" /><link href="test'); Css::registerLibrary('test1', ''); $soll = "\n<link href=\"\" rel=\"stylesheet\" type=\"text/css\" />" . "\n<link href=\"test3.css\" rel=\"stylesheet\" type=\"text/css\" />" . "\n<link href=\"\" /><link href=\"test\" rel=\"stylesheet\" type=\"text/css\" />" . "\n<link href=\"test3.css\" rel=\"stylesheet\" type=\"text/css\" />"; Css::requireLibrary(0); Css::requireLibrary('test2'); //this will create a second entry for text3.css, what is correct html static::assertEquals($soll, Css::getLinkTags()); Css::includeLibraries(); $this->expectOutputString(Css::getLinkTags()); }