/usr/share/php/kohana3.1/system/tests/kohana/LogTest.php is in libkohana3.1-core-php 3.1.5-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | <?php defined('SYSPATH') OR die('Kohana bootstrap needs to be included before tests run');
/**
* Tests Kohana Logging API
*
* @group kohana
* @group kohana.core
* @group kohana.core.logging
*
* @package Kohana
* @category Tests
* @author Kohana Team
* @author Matt Button <matthew@sigswitch.com>
* @copyright (c) 2008-2012 Kohana Team
* @license http://kohanaframework.org/license
*/
class Kohana_LogTest extends Unittest_TestCase
{
/**
* Tests that when a new logger is created the list of messages is initially
* empty
*
* @test
* @covers Log
*/
public function test_messages_is_initially_empty()
{
$logger = new Log;
$this->assertAttributeSame(array(), '_messages', $logger);
}
/**
* Tests that when a new logger is created the list of writers is initially
* empty
*
* @test
* @covers Log
*/
public function test_writers_is_initially_empty()
{
$logger = new Log;
$this->assertAttributeSame(array(), '_writers', $logger);
}
/**
* Test that attaching a log writer using an array of levels adds it to the array of log writers
*
* @TODO Is this test too specific?
*
* @test
* @covers Log::attach
*/
public function test_attach_attaches_log_writer_and_returns_this()
{
$logger = new Log;
$writer = $this->getMockForAbstractClass('Log_Writer');
$this->assertSame($logger, $logger->attach($writer));
$this->assertAttributeSame(
array(spl_object_hash($writer) => array('object' => $writer, 'levels' => array())),
'_writers',
$logger
);
}
/**
* Test that attaching a log writer using a min/max level adds it to the array of log writers
*
* @TODO Is this test too specific?
*
* @test
* @covers Log::attach
*/
public function test_attach_attaches_log_writer_min_max_and_returns_this()
{
$logger = new Log;
$writer = $this->getMockForAbstractClass('Log_Writer');
$this->assertSame($logger, $logger->attach($writer, Log::NOTICE, Log::CRITICAL));
$this->assertAttributeSame(
array(spl_object_hash($writer) => array('object' => $writer, 'levels' => array(Log::CRITICAL, Log::ERROR, Log::WARNING, Log::NOTICE))),
'_writers',
$logger
);
}
/**
* When we call detach() we expect the specified log writer to be removed
*
* @test
* @covers Log::detach
*/
public function test_detach_removes_log_writer_and_returns_this()
{
$logger = new Log;
$writer = $this->getMockForAbstractClass('Log_Writer');
$logger->attach($writer);
$this->assertSame($logger, $logger->detach($writer));
$this->assertAttributeSame(array(), '_writers', $logger);
}
}
|