| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | * This file is part of EC-CUBE |
|---|
| 4 | * |
|---|
| 5 | * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved. |
|---|
| 6 | * |
|---|
| 7 | * http://www.lockon.co.jp/ |
|---|
| 8 | * |
|---|
| 9 | * This program is free software; you can redistribute it and/or |
|---|
| 10 | * modify it under the terms of the GNU General Public License |
|---|
| 11 | * as published by the Free Software Foundation; either version 2 |
|---|
| 12 | * of the License, or (at your option) any later version. |
|---|
| 13 | * |
|---|
| 14 | * This program is distributed in the hope that it will be useful, |
|---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 17 | * GNU General Public License for more details. |
|---|
| 18 | * |
|---|
| 19 | * You should have received a copy of the GNU General Public License |
|---|
| 20 | * along with this program; if not, write to the Free Software |
|---|
| 21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 22 | */ |
|---|
| 23 | |
|---|
| 24 | define('LOG4PHP_CONFIGURATION', realpath(dirname(__FILE__)) . '/conf/log4php.properties'); |
|---|
| 25 | require_once(realpath(dirname(__FILE__)) . "/../../../data/class/logger/log/GC_Log_Log4php.php"); |
|---|
| 26 | require_once("PHPUnit/Framework.php"); |
|---|
| 27 | |
|---|
| 28 | /** |
|---|
| 29 | * GC_Log_Log4phpのテスト |
|---|
| 30 | * |
|---|
| 31 | * プロパティファイルの内容は以下 |
|---|
| 32 | * +--------------------------------------------------------- |
|---|
| 33 | * | log4php.rootLogger=DEBUG, R |
|---|
| 34 | * | log4php.appender.R=LoggerAppenderEcho |
|---|
| 35 | * | log4php.appender.R.layout=LoggerPatternLayout |
|---|
| 36 | * | log4php.appender.R.layout.ConversionPattern="[%p] %m%n" |
|---|
| 37 | * +--------------------------------------------------------- |
|---|
| 38 | * |
|---|
| 39 | * @package Logger |
|---|
| 40 | * @author LOCKON CO.,LTD. |
|---|
| 41 | * @version $Id$ |
|---|
| 42 | * |
|---|
| 43 | */ |
|---|
| 44 | class GC_Log_Log4php_Test extends PHPUnit_Framework_TestCase |
|---|
| 45 | { |
|---|
| 46 | /** |
|---|
| 47 | * DEBUGログのテスト |
|---|
| 48 | * |
|---|
| 49 | * |
|---|
| 50 | */ |
|---|
| 51 | function testGfDebug(){ |
|---|
| 52 | $object = new GC_Log_Log4php(); |
|---|
| 53 | |
|---|
| 54 | ob_start(); |
|---|
| 55 | $object->gfDebug('DEBUGログ'); |
|---|
| 56 | $buff = ob_get_contents(); |
|---|
| 57 | ob_end_clean(); |
|---|
| 58 | |
|---|
| 59 | $output = "[DEBUG] DEBUGログ\n"; |
|---|
| 60 | |
|---|
| 61 | $this->assertEquals($buff, $output); |
|---|
| 62 | } |
|---|
| 63 | |
|---|
| 64 | /** |
|---|
| 65 | * INFOログのテスト |
|---|
| 66 | * |
|---|
| 67 | * |
|---|
| 68 | */ |
|---|
| 69 | function testGfInfo(){ |
|---|
| 70 | $object = new GC_Log_Log4php(); |
|---|
| 71 | |
|---|
| 72 | ob_start(); |
|---|
| 73 | $object->gfInfo('INFOログ'); |
|---|
| 74 | $buff = ob_get_contents(); |
|---|
| 75 | ob_end_clean(); |
|---|
| 76 | |
|---|
| 77 | $output = "[INFO] INFOログ\n"; |
|---|
| 78 | |
|---|
| 79 | $this->assertEquals($buff, $output); |
|---|
| 80 | } |
|---|
| 81 | |
|---|
| 82 | /** |
|---|
| 83 | * ERRORログのテスト |
|---|
| 84 | * |
|---|
| 85 | * |
|---|
| 86 | */ |
|---|
| 87 | function testGfError(){ |
|---|
| 88 | $object = new GC_Log_Log4php(); |
|---|
| 89 | |
|---|
| 90 | ob_start(); |
|---|
| 91 | $object->gfError('ERRORログ'); |
|---|
| 92 | $buff = ob_get_contents(); |
|---|
| 93 | ob_end_clean(); |
|---|
| 94 | |
|---|
| 95 | $output = "[ERROR] ERRORログ\n"; |
|---|
| 96 | |
|---|
| 97 | $this->assertEquals($buff, $output); |
|---|
| 98 | } |
|---|
| 99 | |
|---|
| 100 | /** |
|---|
| 101 | * FATALログのテスト |
|---|
| 102 | * |
|---|
| 103 | * |
|---|
| 104 | */ |
|---|
| 105 | function testGfFatal(){ |
|---|
| 106 | $object = new GC_Log_Log4php(); |
|---|
| 107 | |
|---|
| 108 | ob_start(); |
|---|
| 109 | $object->gfFatal('FATALログ'); |
|---|
| 110 | $buff = ob_get_contents(); |
|---|
| 111 | ob_end_clean(); |
|---|
| 112 | |
|---|
| 113 | $output = "[FATAL] FATALログ\n"; |
|---|
| 114 | |
|---|
| 115 | $this->assertEquals($buff, $output); |
|---|
| 116 | } |
|---|
| 117 | } |
|---|
| 118 | ?> |
|---|