/**
  * @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());
 }
 /**
  * @covers \NewFrontiers\Framework\Output\Mailer::sendMail
  */
 public function testSendMailFails()
 {
     //Create a new Mailer, because other tests use the mailer instance for mocking
     $mailer = new Mailer();
     //reset config (from other tests)
     $config = Configuration::getInstance();
     $reflection = new ReflectionClass($config);
     $reflection_property = $reflection->getProperty('configuration');
     $reflection_property->setAccessible(true);
     $reflection_property->setValue($config, new SimpleXMLElement('<configuration></configuration>'));
     //No configuration is loaded, that means the sender is not set and sendMail() will return false.
     $this->assertFalse($mailer->sendMail(self::$workingMailAdress, "Test-E-Mail von nostromo-framework", "Bitte E-Mail-Adresse in MailerTest.php ändern."));
     $items = Logging::getLogItems();
     $this->assertContains("Kein Absender in der Konfiguration", end($items)["msg"]);
     Configuration::getInstance()->readConfig();
     //empty Empfänger
     $this->assertFalse($mailer->sendMail("", "test", "testnachricht"));
     $items = Logging::getLogItems();
     $this->assertContains("Keine E-Mail Adresse", end($items)["msg"]);
 }
 /**
  * Gibt einen ListView mit den aufgelaufenen Log-Meldungen zurück
  * @return ListGroupControl
  * @throws \Exception
  */
 public function showLog()
 {
     $listGroup = new ListGroupControl(null, 'debugEntries');
     $listGroup->addItems(Logging::getLogItems());
     return $listGroup;
 }