Merge pull request #11 from bessl/patch-2
[gitphp.git] / test / DebugLogTest.php
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
<?php
/**
 * DebugLog test class
 *
 * @author Christopher Han <xiphux@gmail.com>
 * @copyright Copyright (c) 2012 Christopher Han
 * @package GitPHP
 * @subpackage Test
 */
class GitPHP_DebugLogTest extends PHPUnit_Framework_TestCase
{
        protected $log;
 
        protected function setUp()
        {
        //      $this->log = new GitPHP_DebugLog();
        }
 
        public function testLog()
        {
        /*
                $this->assertFalse($this->log->GetEnabled());
                $this->log->Log('Test log message');
                $this->log->ObjectChanged(null, GitPHP_Observer_Interface::LoggableChange, array('Test log message'));
                $this->assertCount(0, $this->log->GetEntries());
 
                $this->log->SetEnabled(true);
                $this->assertTrue($this->log->GetEnabled());
 
                $this->log->Log('Test log message');
                $this->log->ObjectChanged(null, GitPHP_Observer_Interface::LoggableChange, array('Test log message 2'));
                $data = $this->log->GetEntries();
                $this->assertCount(2, $data);
                $this->assertEquals('DEBUG: Test log message', $data[0]);
                $this->assertEquals('DEBUG: Test log message 2', $data[1]);
                
                $this->log->Clear();
                $this->assertCount(0, $this->log->GetEntries());
 
                $this->log->SetEnabled(false);
                $this->assertFalse($this->log->GetEnabled());
        */
        }
 
        public function testBenchmark()
        {
        /*
                $this->log->SetEnabled(true);
                $this->assertFalse($this->log->GetBenchmark());
                $this->log->SetBenchmark(true);
                $this->assertTrue($this->log->GetBenchmark());
 
                $this->log->Log('Test log message');
 
                $data = $this->log->GetEntries();
 
                $this->assertCount(3, $data);
                $this->assertRegExp('/^DEBUG: \[[0-9]+(\.[0-9]+)?\] \[[0-9]+ bytes\] Start$/', $data[0]);
                $this->assertRegExp('/^DEBUG: \[[0-9]+(\.[0-9]+)?\] \[[0-9]+(\.[0-9]+)?(E-[0-9]+)? sec since start\] \[[0-9]+(\.[0-9]+)?(E-[0-9]+)? sec since last\] \[[0-9]+ bytes\] \[[0-9]+ bytes since start\] \[[0-9]+ bytes since last\] Test log message$/', $data[1]);
                $this->assertRegExp('/^DEBUG: \[[0-9]+(\.[0-9]+)?\] \[[0-9]+(\.[0-9]+)?(E-[0-9]+)? sec since start\] \[[0-9]+(\.[0-9]+)?(E-[0-9]+)? sec since last\] \[[0-9]+ bytes\] \[[0-9]+ bytes since start\] \[[0-9]+ bytes since last\] End$/', $data[2]);
 
                $this->log->Clear();
                $this->log->SetBenchmark(false);
                $this->assertFalse($this->log->GetBenchmark());
                $this->log->SetEnabled(false);
        */
        }
 
}
 
comments