PageRenderTime 21ms CodeModel.GetById 13ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/unit/library/Msd/LogTest.php

https://github.com/BugBuster1701/MySQLDumper
PHP | 64 lines | 53 code | 8 blank | 3 comment | 0 complexity | 1cc307a524c504c67067a2f6798a63f1 MD5 | raw file
 1<?php
 2/**
 3 * @group Log
 4 */
 5class Msd_LogTest extends PHPUnit_Framework_TestCase
 6{
 7    public function testCanGetLogger()
 8    {
 9        $logger = new Msd_Log();
10        $this->assertInstanceof('Msd_Log', $logger);
11    }
12
13    public function testCanGetFilePathOfLoggerType()
14    {
15        $logger = new Msd_Log();
16        $this->assertInstanceof('Msd_Log', $logger);
17
18        $logPath = $logger->getFile(Msd_Log::PHP);
19        $this->assertEquals(WORK_PATH . '/log/php.log', $logPath);
20
21        $logPath = $logger->getFile(Msd_Log::PERL);
22        $this->assertEquals(WORK_PATH . '/log/perl.log', $logPath);
23
24        $logPath = $logger->getFile(Msd_Log::PERL_COMPLETE);
25        $this->assertEquals(WORK_PATH . '/log/perlComplete.log', $logPath);
26
27        $logPath = $logger->getFile(Msd_Log::ERROR);
28        $this->assertEquals(WORK_PATH . '/log/phpError.log', $logPath);
29    }
30
31    public function testCanGetLoggerOfGivenType()
32    {
33        $logger = new Msd_Log();
34        $this->assertInstanceof('Msd_Log', $logger);
35        $loggerTypes = array(
36                        Msd_Log::PHP => WORK_PATH . '/log/php.log',
37                        Msd_Log::PERL => WORK_PATH . '/log/perl.log',
38                        Msd_Log::PERL_COMPLETE => WORK_PATH . '/log/perlComplete.log',
39                        Msd_Log::ERROR => WORK_PATH . '/log/phpError.log',
40                  );
41        foreach ($loggerTypes as $logType => $logPath) {
42            $this->assertInstanceof('Zend_Log', $logger->getLogInstance($logType));
43            $this->assertEquals($logger->getFile($logType), $logPath);
44        }
45    }
46
47
48    public function testClosesFileHandlesOnDestroy()
49    {
50        $logger = new Msd_Log();
51        $this->assertInstanceof('Msd_Log', $logger);
52        $loggerTypes = array(
53                        Msd_Log::PHP => WORK_PATH . '/log/php.log',
54                        Msd_Log::PERL => WORK_PATH . '/log/perl.log',
55                        Msd_Log::PERL_COMPLETE => WORK_PATH . '/log/perlComplete.log',
56                        Msd_Log::ERROR => WORK_PATH . '/log/phpError.log',
57                  );
58        foreach ($loggerTypes as $logType => $logPath) {
59            $this->assertInstanceof('Zend_Log', $logger->getLogInstance($logType));
60            $this->assertEquals($logger->getFile($logType), $logPath);
61        }
62        unset($logger);
63    }
64}