PageRenderTime 48ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/fuel/core/tests/log.php

https://bitbucket.org/sriedel/iccrm-wip
PHP | 112 lines | 49 code | 11 blank | 52 comment | 0 complexity | e2c395f92f1721c2f34510f26c3e3352 MD5 | raw file
Possible License(s): MIT
  1. <?php
  2. /**
  3. * Part of the Fuel framework.
  4. *
  5. * @package Fuel
  6. * @version 1.0
  7. * @author Fuel Development Team
  8. * @license MIT License
  9. * @copyright 2010 - 2012 Fuel Development Team
  10. * @link http://fuelphp.com
  11. */
  12. namespace Fuel\Core;
  13. /**
  14. * Log class tests
  15. *
  16. * @group Core
  17. * @group Log
  18. */
  19. class Test_Log extends TestCase
  20. {
  21. public function setUp()
  22. {
  23. $this->log_threshold = \Config::get('log_threshold');
  24. // set the log threshold to a known value
  25. \Config::set('log_threshold', Fuel::L_DEBUG);
  26. }
  27. public function tearDown()
  28. {
  29. \Config::set('log_threshold', $this->log_threshold);
  30. }
  31. /**
  32. * Test for Log::info()
  33. *
  34. * @test
  35. */
  36. public function test_info()
  37. {
  38. $output = Log::info('testing log info');
  39. $this->assertFalse($output); // log level is set to DEBUG
  40. }
  41. /**
  42. * Test for Log::debug()
  43. *
  44. * @test
  45. */
  46. public function test_debug()
  47. {
  48. $output = Log::debug('testing log debug');
  49. $this->assertTrue($output);
  50. }
  51. /**
  52. * Test for Log::error()
  53. *
  54. * @test
  55. */
  56. public function test_error()
  57. {
  58. $output = Log::error('testing log error');
  59. $this->assertTrue($output);
  60. }
  61. /**
  62. * Test for Log::info()
  63. *
  64. * @test
  65. */
  66. public function test_info_method()
  67. {
  68. $output = Log::info('testing log info', 'Log::info');
  69. $this->assertFalse($output); // default log level is DEBUG
  70. }
  71. /**
  72. * Test for Log::debug()
  73. *
  74. * @test
  75. */
  76. public function test_debug_method()
  77. {
  78. $output = Log::debug('testing log debug', 'Log::debug');
  79. $this->assertTrue($output);
  80. }
  81. /**
  82. * Test for Log::error()
  83. *
  84. * @test
  85. */
  86. public function test_error_method()
  87. {
  88. $output = Log::error('testing log error', 'Log::error');
  89. $this->assertTrue($output);
  90. }
  91. /**
  92. * Test for Log::write()
  93. *
  94. * @test
  95. */
  96. public function test_write_custom_level()
  97. {
  98. $output = Log::write('Custom', 'testing custom level log', 'Log::write');
  99. $this->assertTrue($output);
  100. }
  101. }