LoggerTest.php 952 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace Elgg;
  3. class LoggerTest extends \PHPUnit_Framework_TestCase {
  4. public function testLoggingOff() {
  5. $mock = $this->getMock('\Elgg\PluginHooksService', array('trigger'));
  6. $mock->expects($this->never())->method('trigger');
  7. $logger = new \Elgg\Logger($mock);
  8. $logger->setLevel(\Elgg\Logger::OFF);
  9. $this->assertFalse($logger->log("hello"));
  10. }
  11. public function testLoggingLevelTooLow() {
  12. $mock = $this->getMock('\Elgg\PluginHooksService', array('trigger'));
  13. $mock->expects($this->never())->method('trigger');
  14. $logger = new \Elgg\Logger($mock);
  15. $logger->setLevel(\Elgg\Logger::WARNING);
  16. $this->assertFalse($logger->log("hello", \Elgg\Logger::NOTICE));
  17. }
  18. public function testLoggingLevelNotExist() {
  19. $mock = $this->getMock('\Elgg\PluginHooksService', array('trigger'));
  20. $mock->expects($this->never())->method('trigger');
  21. $logger = new \Elgg\Logger($mock);
  22. $this->assertFalse($logger->log("hello", 123));
  23. }
  24. }