Modified: incubator/log4php/trunk/src/test/php/AllTests.php
URL: http://svn.apache.org/viewvc/incubator/lo
g4php/trunk/src/test/php/AllTests.php?view=diff&rev=5568
01&r1=556800&r2=556801
============================================================
==================
--- incubator/log4php/trunk/src/test/php/AllTests.php
(original)
+++ incubator/log4php/trunk/src/test/php/AllTests.php Mon
Jul 16 20:36:21 2007
 -1 +1,67

-<?php
/**
* Copyright 1999,2004 The Apache Software
Foundation.
*
* Licensed under the Apache License,
Version 2.0 (the "License");
* you may not use
this file except in compliance with the License.
* You may
obtain a copy of the License at
*
* http://www
.apache.org/licenses/LICENSE-2.0
*
* Unless required
by applicable law or agreed to in writing, software
*
distributed under the License is distributed on an "AS
IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.
* See the License for the
specific language governing permissions and
* limitations
under the License.
*
* category tests
* package
log4php
* author Marco Vassura
* license http://www
.apache.org/licenses/LICENSE-2.0 Apache License, Version
2.0
* version SVN: $Id$
* link http://logging.apac
he.org/log4php
*/
require_once
dirname(__FILE__).'/phpunit.php';
if(!defined('PHPUnit_MAIN
_METHOD')) {
define('PHPUnit_MAIN_METHOD',
'AllTests::main');
}
require_once
'appenders/AllTests.php';
require_once
'spi/AllTests.php';
require_once
'or/AllTests.php';
require_once
'LoggerLogTest.php';
require_once
'LoggerLevelTest.php';
require_once
'LoggerRootTest.php';
require_once
'LoggerHierarchyTest.php';
require_once
'LoggerBasicConfiguratorTest.php';
class AllTests {
public static function main() {
PHPUnit_TextUI_TestRunner::run(self::suite());
}
public
static function suite() {
$suite = new
PHPUnit_Framework_TestSuite('log4php');
$suite->addTestSuite('LoggerLogTest');
$suite->addTestSuite('LoggerLevelTest');
$suite->addTestSuite('LoggerRootTest');
$suite->addTestSuite('LoggerHierarchyTest');
$suite->addTestSuite('LoggerBasicConfiguratorTest');
$s
uite->addTest(appenders_AllTests::suite());
$suite->addTest(spi_AllTests::suite());
return
$suite;
}
}
if(PHPUnit_MAIN_METHOD == 'AllTests::main')
{
AllTests::main();
}
?>
No newline at end of file
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under
one or more
+ * contributor license agreements. See the NOTICE file
distributed with
+ * this work for additional information regarding copyright
ownership.
+ * The ASF licenses this file to You under the Apache
License, Version 2.0
+ * (the "License"); you may not use this file
except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www
.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in
writing, software
+ * distributed under the License is distributed on an
"AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied.
+ * See the License for the specific language governing
permissions and
+ * limitations under the License.
+ *
+ * category tests
+ * package log4php
+ * author Marco Vassura
+ * license http://www
.apache.org/licenses/LICENSE-2.0 Apache License, Version
2.0
+ * version SVN: $Id$
+ * link http://logging.apac
he.org/log4php
+ */
+
+require_once dirname(__FILE__).'/phpunit.php';
+
+if(!defined('PHPUnit_MAIN_METHOD')) {
+ define('PHPUnit_MAIN_METHOD', 'AllTests::main');
+}
+
+require_once 'appenders/AllTests.php';
+require_once 'spi/AllTests.php';
+require_once 'or/AllTests.php';
+
+require_once 'LoggerLogTest.php';
+require_once 'LoggerLevelTest.php';
+require_once 'LoggerRootTest.php';
+require_once 'LoggerHierarchyTest.php';
+require_once 'LoggerBasicConfiguratorTest.php';
+
+class AllTests {
+ public static function main() {
+ PHPUnit_TextUI_TestRunner::run(self::suite());
+ }
+
+ public static function suite() {
+ $suite = new PHPUnit_Framework_TestSuite('log4php');
+
+ $suite->addTestSuite('LoggerLogTest');
+ $suite->addTestSuite('LoggerLevelTest');
+ $suite->addTestSuite('LoggerRootTest');
+ $suite->addTestSuite('LoggerHierarchyTest');
+
$suite->addTestSuite('LoggerBasicConfiguratorTest');
+
+ $suite->addTest(appenders_AllTests::suite());
+ $suite->addTest(spi_AllTests::suite());
+
+ return $suite;
+ }
+}
+
+if(PHPUnit_MAIN_METHOD == 'AllTests::main') {
+ AllTests::main();
+}
+
+?>
Modified:
incubator/log4php/trunk/src/test/php/LoggerBasicConfigurator
Test.php
URL: http://svn.apache.org/
viewvc/incubator/log4php/trunk/src/test/php/LoggerBasicConfi
guratorTest.php?view=diff&rev=556801&r1=556800&r
2=556801
============================================================
==================
---
incubator/log4php/trunk/src/test/php/LoggerBasicConfigurator
Test.php (original)
+++
incubator/log4php/trunk/src/test/php/LoggerBasicConfigurator
Test.php Mon Jul 16 20:36:21 2007
 -1 +1,84

-<?php
/**
* Copyright 1999,2004 The Apache Software
Foundation.
*
* Licensed under the Apache License,
Version 2.0 (the "License");
* you may not use
this file except in compliance with the License.
* You may
obtain a copy of the License at
*
* http://www
.apache.org/licenses/LICENSE-2.0
*
* Unless required
by applicable law or agreed to in writing, software
*
distributed under the License is distributed on an "AS
IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.
* See the License for the
specific language governing permissions and
* limitations
under the License.
*
* category tests
* package
log4php
* author Marco Vassura
* license http://www
.apache.org/licenses/LICENSE-2.0 Apache License, Version
2.0
* version SVN: $Id$
* link http://logging.apac
he.org/log4php
*/
require_once
dirname(__FILE__).'/phpunit.php';
require_once LOG4PHP_DIR .
'/LoggerBasicConfigurator.php';
class LoggerB
asicConfiguratorTest extends PHPUnit_Framework_TestCase
{
protected function setUp()
{
LoggerBasicConfigurator::configure();
}
protected
function tearDown()
{
LoggerBasicConfigurator::resetConfiguration();
}
pub
lic function testConfigure() {
$root =
LoggerManager::getRootLogger();
$appender =
$root->getAppender('A1');
self::assertType('LoggerAppen
derConsole', $appender);
$layout =
$appender->getLayout();
self::assertType('LoggerLayoutT
TCC', $layout);
}
public function
testResetConfiguration() {
throw new
PHPUnit_Framework_IncompleteTestError();
$this->test
Configure();
//$root =
LoggerManager::getRootLogger();
$hierarchy =
LoggerHierarchy::singleton();
var_dump(count($hierarchy
->getCurrentLoggers()));
LoggerBasicConfigurator::re
setConfiguration();
var_dump(count($hierarchy->getCu
rrentLoggers()));
/*
$logger =
LoggerManager::getLogger('A1');
$layout =
$logger->getLayout();
var_dump($layout);
var_dump
($logger->getName());
*/
//$appender =
LoggerManager::getRootLogger()->getAppender('A1');
//va
r_dump($appender);
}
/*public function
testRootLogger() {
$root =
LoggerManager::getRootLogger();
$a =
$root->getAppender('A1');
self::assertType('LoggerAppen
derConsole', $a);
$l =
$a->getLayout();
self::assertType('LoggerLayoutTTCC',
$l);
}*/
}
?>
No newline at end of file
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under
one or more
+ * contributor license agreements. See the NOTICE file
distributed with
+ * this work for additional information regarding copyright
ownership.
+ * The ASF licenses this file to You under the Apache
License, Version 2.0
+ * (the "License"); you may not use this file
except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www
.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in
writing, software
+ * distributed under the License is distributed on an
"AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied.
+ * See the License for the specific language governing
permissions and
+ * limitations under the License.
+ *
+ * category tests
+ * package log4php
+ * author Marco Vassura
+ * license http://www
.apache.org/licenses/LICENSE-2.0 Apache License, Version
2.0
+ * version SVN: $Id$
+ * link http://logging.apac
he.org/log4php
+ */
+
+require_once dirname(__FILE__).'/phpunit.php';
+require_once LOG4PHP_DIR . '/LoggerBasicConfigurator.php';
+
+class LoggerBasicConfiguratorTest extends
PHPUnit_Framework_TestCase {
+
+ protected function setUp() {
+ LoggerBasicConfigurator::configure();
+ }
+
+ protected function tearDown() {
+
LoggerBasicConfigurator::resetConfiguration();
+ }
+
+ public function testConfigure() {
+ $root = LoggerManager::getRootLogger();
+ $appender = $root->getAppender('A1');
+ self::assertType('LoggerAppenderConsole',
$appender);
+ $layout = $appender->getLayout();
+ self::assertType('LoggerLayoutTTCC',
$layout);
+ }
+
+ public function testResetConfiguration() {
+ throw new
PHPUnit_Framework_IncompleteTestError();
+
+ $this->testConfigure();
+
+ //$root = LoggerManager::getRootLogger();
+
+ $hierarchy = LoggerHierarchy::singleton();
+
+
var_dump(count($hierarchy->getCurrentLoggers()));
+
+
LoggerBasicConfigurator::resetConfiguration();
+
+
var_dump(count($hierarchy->getCurrentLoggers()));
+
+ /*
+ $logger = LoggerManager::getLogger('A1');
+
+ $layout = $logger->getLayout();
+ var_dump($layout);
+
+ var_dump($logger->getName());
+ */
+ //$appender =
LoggerManager::getRootLogger()->getAppender('A1');
+ //var_dump($appender);
+
+ }
+
+ /*public function testRootLogger() {
+ $root = LoggerManager::getRootLogger();
+ $a = $root->getAppender('A1');
+ self::assertType('LoggerAppenderConsole',
$a);
+ $l = $a->getLayout();
+ self::assertType('LoggerLayoutTTCC', $l);
+ }*/
+
+}
+?>
Modified:
incubator/log4php/trunk/src/test/php/LoggerHierarchyTest.php
URL: http://svn.apache.org/viewvc/i
ncubator/log4php/trunk/src/test/php/LoggerHierarchyTest.php?
view=diff&rev=556801&r1=556800&r2=556801
============================================================
==================
---
incubator/log4php/trunk/src/test/php/LoggerHierarchyTest.php
(original)
+++
incubator/log4php/trunk/src/test/php/LoggerHierarchyTest.php
Mon Jul 16 20:36:21 2007
 -1 +1,75

-<?php
/**
* Copyright 1999,2004 The Apache Software
Foundation.
*
* Licensed under the Apache License,
Version 2.0 (the "License");
* you may not use
this file except in compliance with the License.
* You may
obtain a copy of the License at
*
* http://www
.apache.org/licenses/LICENSE-2.0
*
* Unless required
by applicable law or agreed to in writing, software
*
distributed under the License is distributed on an "AS
IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.
* See the License for the
specific language governing permissions and
* limitations
under the License.
*
* category tests
* package
log4php
* author Marco Vassura
* license http://www
.apache.org/licenses/LICENSE-2.0 Apache License, Version
2.0
* version SVN: $Id$
* link http://logging.apac
he.org/log4php
*/
require_once
dirname(__FILE__).'/phpunit.php';
require_once LOG4PHP_DIR
. '/layouts/LoggerLayoutTTCC.php';
require_once
LOG4PHP_DIR .
'/appenders/LoggerAppenderConsole.php';
require_once
LOG4PHP_DIR . '/LoggerHierarchy.php';
class
LoggerHierarchyTest extends PHPUnit_Framework_TestCase
{
private $hierarchy;
protected function setUp()
{
$this->hierarchy =
LoggerHierarchy::singleton();
}
public function
testIfLevelIsInitiallyLevelAll()
{
$this->assertEquals($this->hierarchy->getRootLo
gger()->getLevel()->levelStr, 'ALL');
}
public
function testIfNameIsRoot()
{
$this->assertEquals($this->hierarchy->getRootLo
gger()->getName(), 'root');
}
public function
testIfParentIsNull()
{
$this->assertSame($this->hierarchy->getRootLogg
er()->getParent(), null);
}
public function
testSetParent()
{
$this->hierarchy->getRootLogger()->setParent('d
ummy');
$this->testIfParentIsNull();
}
public
function testResetConfiguration() {
$root =
$this->hierarchy->getRootLogger();
$appender =
new LoggerAppenderConsole('A1');
$root->addAppender($appender);
$logger =
$this->hierarchy->getLogger('test');
$this->assertEquals(sizeof($this->hierarchy->getCur
rentLoggers()), 1);
$this->hierarchy->resetConfiguration();
$this->assertEquals($this->hierarchy->getRootLogger
()->getLevel()->levelStr, 'DEBUG');
$this->assertEquals($this->hierarchy->getThreshold(
)->levelStr, 'ALL');
$this->assertEquals(sizeof($this->hierarchy->getCur
rentLoggers()), 1);
foreach($this->hierarchy->getCurrentLoggers() as $l)
{
$this->assertEquals($l->getLevel(), null);
$this->assertTrue($l->getAdditivity());
$this->assertEquals(sizeof($l->getAllAppenders()),
0);
}
}
}
?>
No newline at end of file
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under
one or more
+ * contributor license agreements. See the NOTICE file
distributed with
+ * this work for additional information regarding copyright
ownership.
+ * The ASF licenses this file to You under the Apache
License, Version 2.0
+ * (the "License"); you may not use this file
except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www
.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in
writing, software
+ * distributed under the License is distributed on an
"AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied.
+ * See the License for the specific language governing
permissions and
+ * limitations under the License.
+ *
+ * category tests
+ * package log4php
+ * author Marco Vassura
+ * license http://www
.apache.org/licenses/LICENSE-2.0 Apache License, Version
2.0
+ * version SVN: $Id$
+ * link http://logging.apac
he.org/log4php
+ */
+
+require_once dirname(__FILE__).'/phpunit.php';
+
+require_once LOG4PHP_DIR .
'/layouts/LoggerLayoutTTCC.php';
+require_once LOG4PHP_DIR .
'/appenders/LoggerAppenderConsole.php';
+require_once LOG4PHP_DIR . '/LoggerHierarchy.php';
+
+class LoggerHierarchyTest extends
PHPUnit_Framework_TestCase {
+
+ private $hierarchy;
+
+ protected function setUp() {
+ $this->hierarchy =
LoggerHierarchy::singleton();
+ }
+
+ public function testIfLevelIsInitiallyLevelAll() {
+
$this->assertEquals($this->hierarchy->getRootLogger
()->getLevel()->levelStr, 'ALL');
+ }
+
+ public function testIfNameIsRoot() {
+
$this->assertEquals($this->hierarchy->getRootLogger
()->getName(), 'root');
+ }
+
+ public function testIfParentIsNull() {
+
$this->assertSame($this->hierarchy->getRootLogger()
->getParent(), null);
+ }
+
+ public function testSetParent() {
+
$this->hierarchy->getRootLogger()->setParent('dummy
');
+ $this->testIfParentIsNull();
+ }
+
+ public function testResetConfiguration() {
+ $root =
$this->hierarchy->getRootLogger();
+ $appender = new LoggerAppenderConsole('A1');
+ $root->addAppender($appender);
+ $logger =
$this->hierarchy->getLogger('test');
+
$this->assertEquals(sizeof($this->hierarchy->getCur
rentLoggers()), 1);
+ $this->hierarchy->resetConfiguration();
+
$this->assertEquals($this->hierarchy->getRootLogger
()->getLevel()->levelStr, 'DEBUG');
+
$this->assertEquals($this->hierarchy->getThreshold(
)->levelStr, 'ALL');
+
$this->assertEquals(sizeof($this->hierarchy->getCur
rentLoggers()), 1);
+ foreach($this->hierarchy->getCurrentLoggers()
as $l) {
+ $this->assertEquals($l->getLevel(),
null);
+
$this->assertTrue($l->getAdditivity());
+
$this->assertEquals(sizeof($l->getAllAppenders()),
0);
+ }
+ }
+
+}
+?>
Modified:
incubator/log4php/trunk/src/test/php/LoggerLevelTest.php
URL: http://svn.apache.org/viewvc/incub
ator/log4php/trunk/src/test/php/LoggerLevelTest.php?view=dif
f&rev=556801&r1=556800&r2=556801
============================================================
==================
--- incubator/log4php/trunk/src/test/php/LoggerLevelTest.php
(original)
+++ incubator/log4php/trunk/src/test/php/LoggerLevelTest.php
Mon Jul 16 20:36:21 2007
 -1 +1,85

-<?php
/**
* Copyright 1999,2004 The Apache Software
Foundation.
*
* Licensed under the Apache License,
Version 2.0 (the "License");
* you may not use
this file except in compliance with the License.
* You may
obtain a copy of the License at
*
* http://www
.apache.org/licenses/LICENSE-2.0
*
* Unless required
by applicable law or agreed to in writing, software
*
distributed under the License is distributed on an "AS
IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.
* See the License for the
specific language governing permissions and
* limitations
under the License.
*
* category tests
* package
log4php
* author Marco Vassura
* license http://www
.apache.org/licenses/LICENSE-2.0 Apache License, Version
2.0
* version SVN: $Id$
* link http://logging.apac
he.org/log4php
*/
require_once
dirname(__FILE__).'/phpunit.php';
require_once LOG4PHP_DIR
. '/LoggerLevel.php';
/**
* Tests the Logg
erLevel
*/
class LoggerLevelTest extends
PHPUnit_Framework_TestCase {
protected function
doTestLevel($o, $code, $str, $syslog) {
$this->assertTrue( $o instanceof LoggerLevel );
$this->assertEquals( $o->level, $code);
$this->assertEquals( $o->levelStr, $str);
$this->assertEquals( $o->syslogEquivalent, $syslog);
}
public function testLevelOff()
{
$this->doTestLevel( LoggerLevel::getLevelOff(),
LOG4PHP_LEVEL_OFF_INT, 'OFF', 0 );
$this->doTestLevel(
LoggerLevel::toLevel(LOG4PHP_LEVEL_OFF_INT),
LOG4PHP_LEVEL_OFF_INT, 'OFF', 0 );
$this->doTestLevel(
LoggerLevel::toLevel('OFF'), LOG4PHP_LEVEL_OFF_INT, 'OFF', 0
);
}
public function testLevelFatal()
{
$this->doTestLevel( LoggerLevel::getLevelFatal(),
LOG4PHP_LEVEL_FATAL_INT, 'FATAL', 0
);
$this->doTestLevel(
LoggerLevel::toLevel(LOG4PHP_LEVEL_FATAL_INT),
LOG4PHP_LEVEL_FATAL_INT, 'FATAL', 0
);
$this->doTestLevel( LoggerLevel::toLevel('FATAL'),
LOG4PHP_LEVEL_FATAL_INT,
'FATAL', 0 );
}
public function testLevelError()
{
$this->doTestLevel( LoggerLevel::getLevelError(),
LOG4PHP_LEVEL_ERROR_INT, 'ERROR', 3
);
$this->doTestLevel(
LoggerLevel::toLevel(LOG4PHP_LEVEL_ERROR_INT),
LOG4PHP_LEVEL_ERROR_INT, 'ERROR', 3
);
$this->doTestLevel( LoggerLevel::toLevel('ERROR'),
LOG4PHP_LEVEL_ERROR_INT, 'ERROR', 3 );
}
public
function testLevelWarn() {
$this->doTestLevel(
LoggerLevel::getLevelWarn(), LOG4PHP_LEVEL_WARN_INT, 'WARN',
4 );
$this->doTestLevel(
LoggerLevel::toLevel(LOG4PHP_LEVEL_WARN_INT),
LOG4PHP_LEVEL_WARN_INT, 'WARN', 4
);
$this->doTestLevel( LoggerLevel::toLevel('WARN'),
LOG4PHP_LEVEL_WARN_INT, 'WARN', 4 );
}
public function
testLevelInfo() {
$this->doTestLevel(
LoggerLevel::getLevelInfo(), LOG4PHP_LEVEL_INFO_INT, 'INFO',
6 );
$this->doTestLevel(
LoggerLevel::toLevel(LOG4PHP_LEVEL_INFO_INT),
LOG4PHP_LEVEL_INFO_INT, 'INFO', 6
);
$this->doTestLevel( LoggerLevel::toLevel('INFO'),
LOG4PHP_LEVEL_INFO_INT, 'INFO
', 6 );
}
public function testLevelDebug()
{
$this->doTestLevel( LoggerLevel::getLevelDebug(),
LOG4PHP_LEVEL_DEBUG_INT, 'DEBUG', 7
);
$this->doTestLevel(
LoggerLevel::toLevel(LOG4PHP_LEVEL_DEBUG_INT),
LOG4PHP_LEVEL_DEBUG_INT, 'DEBUG', 7
);
$this->doTestLevel( LoggerLevel::toLevel('DEBUG'),
LOG4PHP_LEVEL_DEBUG_INT, 'DEBUG', 7 );
}
public
function testLevelAll() {
$this->doTestLevel(
LoggerLevel::getLevelAll(), LOG4PHP_LEVEL_ALL_INT, 'ALL', 7
);
$this->doTestLevel(
LoggerLevel::toLevel(LOG4PHP_LEVEL_ALL_INT),
LOG4PHP_LEVEL_ALL_INT, 'ALL', 7 );
$this->doTestLevel(
LoggerLevel::toLevel('ALL'), LOG4PHP_LEVEL_ALL_INT, 'ALL', 7
);
}
}
?>
No newline at end of file
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under
one or more
+ * contributor license agreements. See the NOTICE file
distributed with
+ * this work for additional information regarding copyright
ownership.
+ * The ASF licenses this file to You under the Apache
License, Version 2.0
+ * (the "License"); you may not use this file
except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www
.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in
writing, software
+ * distributed under the License is distributed on an
"AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied.
+ * See the License for the specific language governing
permissions and
+ * limitations under the License.
+ *
+ * category tests
+ * package log4php
+ * author Marco Vassura
+ * license http://www
.apache.org/licenses/LICENSE-2.0 Apache License, Version
2.0
+ * version SVN: $Id$
+ * link http://logging.apac
he.org/log4php
+ */
+
+require_once dirname(__FILE__).'/phpunit.php';
+
+require_once LOG4PHP_DIR . '/LoggerLevel.php';
+
+/**
+ * Tests the LoggerLevel
+ */
+class LoggerLevelTest extends PHPUnit_Framework_TestCase {
+
+ protected function doTestLevel($o, $code, $str,
$syslog) {
+ $this->assertTrue( $o instanceof LoggerLevel );
+ $this->assertEquals( $o->level, $code);
+ $this->assertEquals( $o->levelStr, $str);
+ $this->assertEquals( $o->syslogEquivalent,
$syslog);
+ }
+
+ public function testLevelOff() {
+ $this->doTestLevel(
LoggerLevel::getLevelOff(), LOG4PHP_LEVEL_OFF_INT, 'OFF', 0
);
+ $this->doTestLevel(
LoggerLevel::toLevel(LOG4PHP_LEVEL_OFF_INT),
LOG4PHP_LEVEL_OFF_INT, 'OFF', 0 );
+ $this->doTestLevel(
LoggerLevel::toLevel('OFF'), LOG4PHP_LEVEL_OFF_INT, 'OFF', 0
);
+ }
+
+
+ public function testLevelFatal() {
+ $this->doTestLevel(
LoggerLevel::getLevelFatal(), LOG4PHP_LEVEL_FATAL_INT,
'FATAL', 0 );
+ $this->doTestLevel(
LoggerLevel::toLevel(LOG4PHP_LEVEL_FATAL_INT),
LOG4PHP_LEVEL_FATAL_INT, 'FATAL', 0 );
+ $this->doTestLevel(
LoggerLevel::toLevel('FATAL'), LOG4PHP_LEVEL_FATAL_INT,
'FATAL', 0 );
+ }
+
+ public function testLevelError() {
+ $this->doTestLevel(
LoggerLevel::getLevelError(), LOG4PHP_LEVEL_ERROR_INT,
'ERROR', 3 );
+ $this->doTestLevel(
LoggerLevel::toLevel(LOG4PHP_LEVEL_ERROR_INT),
LOG4PHP_LEVEL_ERROR_INT, 'ERROR', 3 );
+ $this->doTestLevel(
LoggerLevel::toLevel('ERROR'), LOG4PHP_LEVEL_ERROR_INT,
'ERROR', 3 );
+ }
+
+ public function testLevelWarn() {
+ $this->doTestLevel(
LoggerLevel::getLevelWarn(), LOG4PHP_LEVEL_WARN_INT, 'WARN',
4 );
+ $this->doTestLevel(
LoggerLevel::toLevel(LOG4PHP_LEVEL_WARN_INT),
LOG4PHP_LEVEL_WARN_INT, 'WARN', 4 );
+ $this->doTestLevel(
LoggerLevel::toLevel('WARN'), LOG4PHP_LEVEL_WARN_INT,
'WARN', 4 );
+ }
+
+ public function testLevelInfo() {
+ $this->doTestLevel(
LoggerLevel::getLevelInfo(), LOG4PHP_LEVEL_INFO_INT, 'INFO',
6 );
+ $this->doTestLevel(
LoggerLevel::toLevel(LOG4PHP_LEVEL_INFO_INT),
LOG4PHP_LEVEL_INFO_INT, 'INFO', 6 );
+ $this->doTestLevel(
LoggerLevel::toLevel('INFO'), LOG4PHP_LEVEL_INFO_INT,
'INFO', 6 );
+ }
+
+ public function testLevelDebug() {
+ $this->doTestLevel(
LoggerLevel::getLevelDebug(), LOG4PHP_LEVEL_DEBUG_INT,
'DEBUG', 7 );
+ $this->doTestLevel(
LoggerLevel::toLevel(LOG4PHP_LEVEL_DEBUG_INT),
LOG4PHP_LEVEL_DEBUG_INT, 'DEBUG', 7 );
+ $this->doTestLevel(
LoggerLevel::toLevel('DEBUG'), LOG4PHP_LEVEL_DEBUG_INT,
'DEBUG', 7 );
+ }
+
+ public function testLevelAll() {
+ $this->doTestLevel(
LoggerLevel::getLevelAll(), LOG4PHP_LEVEL_ALL_INT, 'ALL', 7
);
+ $this->doTestLevel(
LoggerLevel::toLevel(LOG4PHP_LEVEL_ALL_INT),
LOG4PHP_LEVEL_ALL_INT, 'ALL', 7 );
+ $this->doTestLevel(
LoggerLevel::toLevel('ALL'), LOG4PHP_LEVEL_ALL_INT, 'ALL', 7
);
+ }
+}
+?>
Modified:
incubator/log4php/trunk/src/test/php/LoggerLogTest.php
URL: http://svn.apache.org/viewvc/incubat
or/log4php/trunk/src/test/php/LoggerLogTest.php?view=diff&am
p;rev=556801&r1=556800&r2=556801
============================================================
==================
--- incubator/log4php/trunk/src/test/php/LoggerLogTest.php
(original)
+++ incubator/log4php/trunk/src/test/php/LoggerLogTest.php
Mon Jul 16 20:36:21 2007
 -1 +1,47

-<?php
/**
* Copyright 1999,2004 The Apache Software
Foundation.
*
* Licensed under the Apache License,
Version 2.0 (the "License");
* you may not use
this file except in compliance with the License.
* You may
obtain a copy of the License at
*
* http://www
.apache.org/licenses/LICENSE-2.0
*
* Unless required
by applicable law or agreed to in writing, software
*
distributed under the License is distributed on an "AS
IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.
* See the License for the
specific language governing permissions and
* limitations
under the License.
*
* category tests
* package
log4php
* author Marco Vassura
* license http://www
.apache.org/licenses/LICENSE-2.0 Apache License, Version
2.0
* version SVN: $Id$
* link http://logging.apac
he.org/log4php
*/
require_once
dirname(__FILE__).'/phpunit.php';
require_once LOG4PHP_DIR
. '/LoggerLog.php';
class LoggerLogTest extend
s PHPUnit_Framework_TestCase {
public function
testInternalDebuggingIsInitallyFalse() {
$this->assertFalse( LoggerLog::internalDebugging() );
}
public function testInternalDebuggingIsSetTrue()
{
LoggerLog::internalDebugging( true );
$this->assertTrue( LoggerLog::internalDebugging() );
}
public function testInternalDebuggingIsSetFalse()
{
LoggerLog::internalDebugging( false );
$this->assertFalse( LoggerLog::internalDebugging() );
}
}
?>
No newline at end of file
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under
one or more
+ * contributor license agreements. See the NOTICE file
distributed with
+ * this work for additional information regarding copyright
ownership.
+ * The ASF licenses this file to You under the Apache
License, Version 2.0
+ * (the "License"); you may not use this file
except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www
.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in
writing, software
+ * distributed under the License is distributed on an
"AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied.
+ * See the License for the specific language governing
permissions and
+ * limitations under the License.
+ *
+ * category tests
+ * package log4php
+ * author Marco Vassura
+ * license http://www
.apache.org/licenses/LICENSE-2.0 Apache License, Version
2.0
+ * version SVN: $Id$
+ * link http://logging.apac
he.org/log4php
+ */
+
+require_once dirname(__FILE__).'/phpunit.php';
+
+require_once LOG4PHP_DIR . '/LoggerLog.php';
+
+class LoggerLogTest extends PHPUnit_Framework_TestCase {
+
+ public function
testInternalDebuggingIsInitallyFalse() {
+ $this->assertFalse(
LoggerLog::internalDebugging() );
+ }
+
+ public function testInternalDebuggingIsSetTrue() {
+ LoggerLog::internalDebugging( true );
+ $this->assertTrue(
LoggerLog::internalDebugging() );
+ }
+
+ public function testInternalDebuggingIsSetFalse()
{
+ LoggerLog::internalDebugging( false );
+ $this->assertFalse(
LoggerLog::internalDebugging() );
+ }
+
+}
+?>
Modified:
incubator/log4php/trunk/src/test/php/LoggerManagerTest.php
URL: http://svn.apache.org/viewvc/inc
ubator/log4php/trunk/src/test/php/LoggerManagerTest.php?view
=diff&rev=556801&r1=556800&r2=556801
============================================================
==================
---
incubator/log4php/trunk/src/test/php/LoggerManagerTest.php
(original)
+++
incubator/log4php/trunk/src/test/php/LoggerManagerTest.php
Mon Jul 16 20:36:21 2007
 -1 +1,36

-<?php
/**
* Copyright 1999,2004 The Apache Software
Foundation.
*
* Licensed under the Apache License,
Version 2.0 (the "License");
* you may not use
this file except in compliance with the License.
* You may
obtain a copy of the License at
*
* http://www
.apache.org/licenses/LICENSE-2.0
*
* Unless required
by applicable law or agreed to in writing, software
*
distributed under the License is distributed on an "AS
IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.
* See the License for the
specific language governing permissions and
* limitations
under the License.
*
* category tests
* package
log4php
* author Marco Vassura
* license http://www
.apache.org/licenses/LICENSE-2.0 Apache License, Version
2.0
* version SVN: $Id$
* link http://logging.apac
he.org/log4php
*/
require_once
dirname(__FILE__).'/phpunit.php';
require_once LOG4PHP_DIR
. '/LoggerManager.php';
class LoggerManagerTes
t extends PHPUnit_Framework_TestCase {
}
?>
No newline at end of file
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under
one or more
+ * contributor license agreements. See the NOTICE file
distributed with
+ * this work for additional information regarding copyright
ownership.
+ * The ASF licenses this file to You under the Apache
License, Version 2.0
+ * (the "License"); you may not use this file
except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www
.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in
writing, software
+ * distributed under the License is distributed on an
"AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied.
+ * See the License for the specific language governing
permissions and
+ * limitations under the License.
+ *
+ * category tests
+ * package log4php
+ * author Marco Vassura
+ * license http://www
.apache.org/licenses/LICENSE-2.0 Apache License, Version
2.0
+ * version SVN: $Id$
+ * link http://logging.apac
he.org/log4php
+ */
+
+require_once dirname(__FILE__).'/phpunit.php';
+
+require_once LOG4PHP_DIR . '/LoggerManager.php';
+
+class LoggerManagerTest extends PHPUnit_Framework_TestCase
{
+
+
+
+}
+
+?>
Modified:
incubator/log4php/trunk/src/test/php/LoggerRootTest.php
URL: http://svn.apache.org/viewvc/incuba
tor/log4php/trunk/src/test/php/LoggerRootTest.php?view=diff&
amp;rev=556801&r1=556800&r2=556801
============================================================
==================
--- incubator/log4php/trunk/src/test/php/LoggerRootTest.php
(original)
+++ incubator/log4php/trunk/src/test/php/LoggerRootTest.php
Mon Jul 16 20:36:21 2007
 -1 +1,56

-<?php
/**
* Copyright 1999,2004 The Apache Software
Foundation.
*
* Licensed under the Apache License,
Version 2.0 (the "License");
* you may not use
this file except in compliance with the License.
* You may
obtain a copy of the License at
*
* http://www
.apache.org/licenses/LICENSE-2.0
*
* Unless required
by applicable law or agreed to in writing, software
*
distributed under the License is distributed on an "AS
IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.
* See the License for the
specific language governing permissions and
* limitations
under the License.
*
* category tests
* package
log4php
* author Marco Vassura
* license http://www
.apache.org/licenses/LICENSE-2.0 Apache License, Version
2.0
* version SVN: $Id$
* link http://logging.apac
he.org/log4php
*/
require_once
dirname(__FILE__).'/phpunit.php';
require_once LOG4PHP_DIR
. '/LoggerRoot.php';
class LoggerRootTest exte
nds PHPUnit_Framework_TestCase {
private
$loggerRoot;
protected function setUp()
{
$this->loggerRoot = new LoggerRoot();
}
public
function testIfLevelIsInitiallyLevelAll()
{
$this->assertEquals($this->loggerRoot->getLevel
()->levelStr, 'ALL');
}
public function
testIfNameIsRoot()
{
$this->assertEquals($this->loggerRoot->getName(
), 'root');
}
public function testIfParentIsNull()
{
$this->assertSame($this->loggerRoot->getParent(
), null);
}
public function testSetParent()
{
$this->loggerRoot->setParent('dummy');
$this->
;testIfParentIsNull();
}
}
?>
No newline at end of file
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under
one or more
+ * contributor license agreements. See the NOTICE file
distributed with
+ * this work for additional information regarding copyright
ownership.
+ * The ASF licenses this file to You under the Apache
License, Version 2.0
+ * (the "License"); you may not use this file
except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www
.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in
writing, software
+ * distributed under the License is distributed on an
"AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied.
+ * See the License for the specific language governing
permissions and
+ * limitations under the License.
+ *
+ * category tests
+ * package log4php
+ * author Marco Vassura
+ * license http://www
.apache.org/licenses/LICENSE-2.0 Apache License, Version
2.0
+ * version SVN: $Id$
+ * link http://logging.apac
he.org/log4php
+ */
+
+require_once dirname(__FILE__).'/phpunit.php';
+
+require_once LOG4PHP_DIR . '/LoggerRoot.php';
+
+class LoggerRootTest extends PHPUnit_Framework_TestCase {
+
+ private $loggerRoot;
+
+ protected function setUp() {
+ $this->loggerRoot = new LoggerRoot();
+ }
+
+ public function testIfLevelIsInitiallyLevelAll() {
+
$this->assertEquals($this->loggerRoot->getLevel()-&
gt;levelStr, 'ALL');
+ }
+
+ public function testIfNameIsRoot() {
+
$this->assertEquals($this->loggerRoot->getName(),
'root');
+ }
+
+ public function testIfParentIsNull() {
+
$this->assertSame($this->loggerRoot->getParent(),
null);
+ }
+
+ public function testSetParent() {
+
$this->loggerRoot->setParent('dummy');
+ $this->testIfParentIsNull();
+ }
+
+}
+?>
Modified:
incubator/log4php/trunk/src/test/php/appenders/AllTests.php
URL: http://svn.apache.org/viewvc/in
cubator/log4php/trunk/src/test/php/appenders/AllTests.php?vi
ew=diff&rev=556801&r1=556800&r2=556801
============================================================
==================
---
incubator/log4php/trunk/src/test/php/appenders/AllTests.php
(original)
+++
incubator/log4php/trunk/src/test/php/appenders/AllTests.php
Mon Jul 16 20:36:21 2007
 -1 +1,54

-<?php
/**
* Copyright 1999,2004 The Apache Software
Foundation.
*
* Licensed under the Apache License,
Version 2.0 (the "License");
* you may not use
this file except in compliance with the License.
* You may
obtain a copy of the License at
*
* http://www
.apache.org/licenses/LICENSE-2.0
*
* Unless required
by applicable law or agreed to in writing, software
*
distributed under the License is distributed on an "AS
IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.
* See the License for the
specific language governing permissions and
* limitations
under the License.
*
* category tests
* package
log4php
* author Knut Urdalen <knut.urdalen gmail.com>
* license http://www
.apache.org/licenses/LICENSE-2.0 Apache License, Version
2.0
* version SVN: $Id$
* link http://logging.apac
he.org/log4php
*/
require_once
dirname(__FILE__).'/../phpunit.php';
if
(!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD',
'appenders_AllTests::main');
}
require_once
'appenders/LoggerAppenderNullTest.php';
require_once
'appenders/LoggerAppenderConsoleTest.php';
class
appenders_AllTests {
public static function main() {
PHPUnit_TextUI_TestRunner::run(self::suite());
}
public static function suite() {
$suite = new
PHPUnit_Framework_TestSuite('log4php.appenders');
$suite->addTestSuite('LoggerAppenderNullTest');
$suite-
>addTestSuite('LoggerAppenderConsoleTest');
return $suite;
}
}
if (PHPUnit_MAIN_METHOD ==
'appenders_AllTests::main') {
appenders_AllTests::main();
}
?>
No newline at end of file
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under
one or more
+ * contributor license agreements. See the NOTICE file
distributed with
+ * this work for additional information regarding copyright
ownership.
+ * The ASF licenses this file to You under the Apache
License, Version 2.0
+ * (the "License"); you may not use this file
except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www
.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in
writing, software
+ * distributed under the License is distributed on an
"AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied.
+ * See the License for the specific language governing
permissions and
+ * limitations under the License.
+ *
+ * category tests
+ * package log4php
+ * author Knut Urdalen <knut.urdalen gmail.com>
+ * license http://www
.apache.org/licenses/LICENSE-2.0 Apache License, Version
2.0
+ * version SVN: $Id$
+ * link http://logging.apac
he.org/log4php
+ */
+
+require_once dirname(__FILE__).'/../phpunit.php';
+
+if (!defined('PHPUnit_MAIN_METHOD')) {
+ define('PHPUnit_MAIN_METHOD',
'appenders_AllTests::main');
+}
+
+require_once 'appenders/LoggerAppenderNullTest.php';
+require_once 'appenders/LoggerAppenderConsoleTest.php';
+
+class appenders_AllTests {
+
+ public static function main() {
+ PHPUnit_TextUI_TestRunner::run(self::suite());
+ }
+
+ public static function suite() {
+ $suite = new
PHPUnit_Framework_TestSuite('log4php.appenders');
+
+ $suite->addTestSuite('LoggerAppenderNullTest');
+
$suite->addTestSuite('LoggerAppenderConsoleTest');
+
+ return $suite;
+ }
+}
+
+if (PHPUnit_MAIN_METHOD == 'appenders_AllTests::main') {
+ appenders_AllTests::main();
+}
+?>
Modified:
incubator/log4php/trunk/src/test/php/appenders/LoggerAppende
rConsoleTest.php
URL: http://svn.apa
che.org/viewvc/incubator/log4php/trunk/src/test/php/appender
s/LoggerAppenderConsoleTest.php?view=diff&rev=556801&
;r1=556800&r2=556801
============================================================
==================
---
incubator/log4php/trunk/src/test/php/appenders/LoggerAppende
rConsoleTest.php (original)
+++
incubator/log4php/trunk/src/test/php/appenders/LoggerAppende
rConsoleTest.php Mon Jul 16 20:36:21 2007
 -1 +1,32

-<?php
require_once
dirname(__FILE__).'/../phpunit.php';
require_once
LOG4PHP_DIR . '/appenders/LoggerAppenderConsole.php';
class
LoggerAppenderConsoleTest extends PHPUnit_Framework_TestCase
{
public function setUp() {
}
public function
tearDown() {
}
public function testSetTarget() {
throw new PHPUnit_Framework_IncompleteTestError();
}
public function testGetTarget() {
throw new
PHPUnit_Framework_IncompleteTestError();
}
public
function testActivateOptions() {
throw new
PHPUnit_Framework_IncompleteTestError();
}
public function testClose() {
throw new
PHPUnit_Framework_IncompleteTestError();
}
}
?>
No newline at end of file
+<?php
+require_once dirname(__FILE__).'/../phpunit.php';
+
+require_once LOG4PHP_DIR .
'/appenders/LoggerAppenderConsole.php';
+
+class LoggerAppenderConsoleTest extends
PHPUnit_Framework_TestCase {
+
+ public function setUp() {
+ }
+
+ public function tearDown() {
+ }
+
+ public function testSetTarget() {
+ throw new
PHPUnit_Framework_IncompleteTestError();
+ }
+
+ public function testGetTarget() {
+ throw new
PHPUnit_Framework_IncompleteTestError();
+ }
+
+ public function testActivateOptions() {
+ throw new
PHPUnit_Framework_IncompleteTestError();
+ }
+
+ public function testClose() {
+ throw new
PHPUnit_Framework_IncompleteTestError();
+ }
+
+}
+
+?>
Modified:
incubator/log4php/trunk/src/test/php/appenders/LoggerAppende
rNullTest.php
URL: http://svn.apache
.org/viewvc/incubator/log4php/trunk/src/test/php/appenders/L
oggerAppenderNullTest.php?view=diff&rev=556801&r1=55
6800&r2=556801
============================================================
==================
---
incubator/log4php/trunk/src/test/php/appenders/LoggerAppende
rNullTest.php (original)
+++
incubator/log4php/trunk/src/test/php/appenders/LoggerAppende
rNullTest.php Mon Jul 16 20:36:21 2007
 -1 +1,24

-<?php
require_once
dirname(__FILE__).'/../phpunit.php';
require_once
LOG4PHP_DIR . '/appenders/LoggerAppenderNull.php';
class
LoggerAppenderNullTest extends PHPUnit_Framework_TestCase
{
public function setUp() {
}
public function
tearDown() {
}
public function testActivateOptions() {
throw new PHPUnit_Framework_IncompleteTestError();
}
public function testClose() {
throw new
PHPUnit_Framework_IncompleteTestError();
}
}
?>
No newline at end of file
+<?php
+require_once dirname(__FILE__).'/../phpunit.php';
+
+require_once LOG4PHP_DIR .
'/appenders/LoggerAppenderNull.php';
+
+class LoggerAppenderNullTest extends
PHPUnit_Framework_TestCase {
+
+ public function setUp() {
+ }
+
+ public function tearDown() {
+ }
+
+ public function testActivateOptions() {
+ throw new
PHPUnit_Framework_IncompleteTestError();
+ }
+
+ public function testClose() {
+ throw new
PHPUnit_Framework_IncompleteTestError();
+ }
+
+}
+
+?>
Modified:
incubator/log4php/trunk/src/test/php/or/AllTests.php
URL: http://svn.apache.org/viewvc/incubator
/log4php/trunk/src/test/php/or/AllTests.php?view=diff&re
v=556801&r1=556800&r2=556801
============================================================
==================
--- incubator/log4php/trunk/src/test/php/or/AllTests.php
(original)
+++ incubator/log4php/trunk/src/test/php/or/AllTests.php Mon
Jul 16 20:36:21 2007
 -1 +1,30

-<?php
require_once
dirname(__FILE__).'/../phpunit.php';
if
(!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD',
'or_AllTests::main');
}
require_once
'LoggerDefaultRendererTest.php';
require_once
'LoggerRendererMapTest.php';
class or_AllTests {
public static function main() {
PHPUnit_TextUI_TestRunner::run(self::suite());
}
public static function suite() {
$suite = new
PHPUnit_Framework_TestSuite('log4php.or');
$suite->addTestSuite('LoggerDefaultRendererTest');
$sui
te->addTestSuite('LoggerRendererMapTest');
return $suite;
}
}
if (PHPUnit_MAIN_METHOD ==
'or_AllTests::main') {
or_AllTests::main();
}
?>
No newline at end of file
+<?php
+require_once dirname(__FILE__).'/../phpunit.php';
+
+if (!defined('PHPUnit_MAIN_METHOD')) {
+ define('PHPUnit_MAIN_METHOD', 'or_AllTests::main');
+}
+
+require_once 'LoggerDefaultRendererTest.php';
+require_once 'LoggerRendererMapTest.php';
+
+class or_AllTests {
+
+ public static function main() {
+ PHPUnit_TextUI_TestRunner::run(self::suite());
+ }
+
+ public static function suite() {
+ $suite = new
PHPUnit_Framework_TestSuite('log4php.or');
+
+
$suite->addTestSuite('LoggerDefaultRendererTest');
+
$suite->addTestSuite('LoggerRendererMapTest');
+
+ return $suite;
+ }
+}
+
+if (PHPUnit_MAIN_METHOD == 'or_AllTests::main') {
+ or_AllTests::main();
+}
+?>
Modified:
incubator/log4php/trunk/src/test/php/or/LoggerDefaultRendere
rTest.php
URL: http://svn.apache.org
/viewvc/incubator/log4php/trunk/src/test/php/or/LoggerDefaul
tRendererTest.php?view=diff&rev=556801&r1=556800&
;r2=556801
============================================================
==================
---
incubator/log4php/trunk/src/test/php/or/LoggerDefaultRendere
rTest.php (original)
+++
incubator/log4php/trunk/src/test/php/or/LoggerDefaultRendere
rTest.php Mon Jul 16 20:36:21 2007
 -1 +1,28

-<?php
require_once
dirname(__FILE__).'/../phpunit.php';
require_once
LOG4PHP_DIR.'/or/LoggerDefaultRenderer.php';
class
DefaultRendererMockObject {
private $a;
protected
$b;
public $c;
}
class LoggerDefaultRendererTest extends
PHPUnit_Framework_TestCase {
protected function setUp()
{
}
protected function tearDown() {
}
public
function testDoRender() {
$class = new
DefaultRendererMockObject();
$renderer = new
LoggerDefaultRenderer();
self::assertEquals(var_export($cl
ass, true), $renderer->doRender($class));
}
}
?>
No newline at end of file
+<?php
+
+require_once dirname(__FILE__).'/../phpunit.php';
+
+require_once LOG4PHP_DIR.'/or/LoggerDefaultRenderer.php';
+
+class DefaultRendererMockObject {
+ private $a;
+ protected $b;
+ public $c;
+}
+
+class LoggerDefaultRendererTest extends
PHPUnit_Framework_TestCase {
+
+ protected function setUp() {
+ }
+
+ protected function tearDown() {
+ }
+
+ public function testDoRender() {
+ $class = new DefaultRendererMockObject();
+ $renderer = new LoggerDefaultRenderer();
+ self::assertEquals(var_export($class,
true), $renderer->doRender($class));
+ }
+
+}
+?>
Modified:
incubator/log4php/trunk/src/test/php/or/LoggerObjectRenderer
Test.php
URL: http://svn.apache.org/
viewvc/incubator/log4php/trunk/src/test/php/or/LoggerObjectR
endererTest.php?view=diff&rev=556801&r1=556800&r
2=556801
============================================================
==================
---
incubator/log4php/trunk/src/test/php/or/LoggerObjectRenderer
Test.php (original)
+++
incubator/log4php/trunk/src/test/php/or/LoggerObjectRenderer
Test.php Mon Jul 16 20:36:21 2007
 -1 +1,21

-<?php
require_once
dirname(__FILE__).'/../phpunit.php';
require_once
LOG4PHP_DIR.'/or/LoggerObjectRenderer.php';
class
LoggerObjectRendererTest extends PHPUnit_Framework_TestCase
{
protected function setUp() {
}
protected function
tearDown() {
}
public function testFactory()
{
$renderer =
LoggerObjectRenderer::factory('LoggerDefaultRenderer');
se
lf::assertType('LoggerDefaultRenderer',
$renderer);
}
}
?>
No newline at end of file
+<?php
+
+require_once dirname(__FILE__).'/../phpunit.php';
+
+require_once LOG4PHP_DIR.'/or/LoggerObjectRenderer.php';
+
+class LoggerObjectRendererTest extends
PHPUnit_Framework_TestCase {
+
+ protected function setUp() {
+ }
+
+ protected function tearDown() {
+ }
+
+ public function testFactory() {
+ $renderer =
LoggerObjectRenderer::factory('LoggerDefaultRenderer');
+ self::assertType('LoggerDefaultRenderer',
$renderer);
+ }
+
+}
+?>
Modified:
incubator/log4php/trunk/src/test/php/or/LoggerRendererMapTes
t.php
URL: http://svn.apache.org/vie
wvc/incubator/log4php/trunk/src/test/php/or/LoggerRendererMa
pTest.php?view=diff&rev=556801&r1=556800&r2=5568
01
============================================================
==================
---
incubator/log4php/trunk/src/test/php/or/LoggerRendererMapTes
t.php (original)
+++
incubator/log4php/trunk/src/test/php/or/LoggerRendererMapTes
t.php Mon Jul 16 20:36:21 2007
 -1 +1,58

-<?php
require_once
dirname(__FILE__).'/../phpunit.php';
require_once
LOG4PHP_DIR.'/or/LoggerRendererMap.php';
require_once
LOG4PHP_DIR.'/LoggerHierarchy.php';
class
LoggerRendererMapTest extends PHPUnit_Framework_TestCase
{
protected function setUp() {
}
protected function
tearDown() {
}
public function testAddRenderer()
{
$hierarchy =
LoggerHierarchy::singleton();
//print_r($hierarchy);
LoggerRendererMap::addRenderer($hierarchy, 'string',
'LoggerDefaultRenderer');
//print_r($hierarchy);
t
hrow new
PHPUnit_Framework_IncompleteTestError();
}
public
function testFindAndRender() {
throw new
PHPUnit_Framework_IncompleteTestError();
}
public
function testGetByObject() {
throw new
PHPUnit_Framework_IncompleteTestError();
}
public
function testGetByClassName() {
throw new
PHPUnit_Framework_IncompleteTestError();
}
public
function testGetDefaultRenderer() {
throw new
PHPUnit_Framework_IncompleteTestError();
}
public f
unction testClear() {
throw new
PHPUnit_Framework_IncompleteTestError();
}
public
function testPut() {
throw new
PHPUnit_Framework_IncompleteTestError();
}
public
function testRendererExists() {
throw new
PHPUnit_Framework_IncompleteTestError();
}
}
?>
No newline at end of file
+<?php
+
+require_once dirname(__FILE__).'/../phpunit.php';
+
+require_once LOG4PHP_DIR.'/or/LoggerRendererMap.php';
+require_once LOG4PHP_DIR.'/LoggerHierarchy.php';
+
+class LoggerRendererMapTest extends
PHPUnit_Framework_TestCase {
+
+ protected function setUp() {
+ }
+
+ protected function tearDown() {
+ }
+
+ public function testAddRenderer() {
+
+ $hierarchy = LoggerHierarchy::singleton();
+
+ //print_r($hierarchy);
+
+ LoggerRendererMap::addRenderer($hierarchy,
'string', 'LoggerDefaultRenderer');
+
+ //print_r($hierarchy);
+
+ throw new
PHPUnit_Framework_IncompleteTestError();
+ }
+
+ public function testFindAndRender() {
+ throw new
PHPUnit_Framework_IncompleteTestError();
+ }
+
+ public function testGetByObject() {
+ throw new
PHPUnit_Framework_IncompleteTestError();
+ }
+
+ public function testGetByClassName() {
+ throw new
PHPUnit_Framework_IncompleteTestError();
+ }
+
+ public function testGetDefaultRenderer() {
+ throw new
PHPUnit_Framework_IncompleteTestError();
+ }
+
+ public function testClear() {
+ throw new
PHPUnit_Framework_IncompleteTestError();
+ }
+
+ public function testPut() {
+ throw new
PHPUnit_Framework_IncompleteTestError();
+ }
+
+ public function testRendererExists() {
+ throw new
PHPUnit_Framework_IncompleteTestError();
+ }
+
+}
+?>
Modified:
incubator/log4php/trunk/src/test/php/spi/AllTests.php
URL: http://svn.apache.org/viewvc/incubato
r/log4php/trunk/src/test/php/spi/AllTests.php?view=diff&
rev=556801&r1=556800&r2=556801
============================================================
==================
--- incubator/log4php/trunk/src/test/php/spi/AllTests.php
(original)
+++ incubator/log4php/trunk/src/test/php/spi/AllTests.php
Mon Jul 16 20:36:21 2007
 -1 +1,52

-<?php
/**
* Copyright 1999,2004 The Apache Software
Foundation.
*
* Licensed under the Apache License,
Version 2.0 (the "License");
* you may not use
this file except in compliance with the License.
* You may
obtain a copy of the License at
*
* http://www
.apache.org/licenses/LICENSE-2.0
*
* Unless required
by applicable law or agreed to in writing, software
*
distributed under the License is distributed on an "AS
IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.
* See the License for the
specific language governing permissions and
* limitations
under the License.
*
* category tests
* package
log4php
* author Marco Vassura
* license http://www
.apache.org/licenses/LICENSE-2.0 Apache License, Version
2.0
* version SVN: $Id$
* link http://logging.apac
he.org/log4php
*/
require_once
dirname(__FILE__).'/../phpunit.php';
if
(!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_ME
THOD', 'spi_AllTests::main');
}
require_once
'spi/LoggerLoggingEventTest.php';
class spi_AllTests {
public static function main() {
PHPUnit_TextUI_TestRunner::run(self::suite());
}
public static function suite() {
$suite = new
PHPUnit_Framework_TestSuite('log4php.spi');
$suite->addTestSuite('LoggerLoggingEventTest');
return $suite;
}
}
if (PHPUnit_MAIN_METHOD ==
'spi_AllTests::main') {
spi_AllTests::main();
}
?>
No newline at end of file
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under
one or more
+ * contributor license agreements. See the NOTICE file
distributed with
+ * this work for additional information regarding copyright
ownership.
+ * The ASF licenses this file to You under the Apache
License, Version 2.0
+ * (the "License"); you may not use this file
except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www
.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in
writing, software
+ * distributed under the License is distributed on an
"AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied.
+ * See the License for the specific language governing
permissions and
+ * limitations under the License.
+ *
+ * category tests
+ * package log4php
+ * author Marco Vassura
+ * license http://www
.apache.org/licenses/LICENSE-2.0 Apache License, Version
2.0
+ * version SVN: $Id$
+ * link http://logging.apac
he.org/log4php
+ */
+
+require_once dirname(__FILE__).'/../phpunit.php';
+
+if (!defined('PHPUnit_MAIN_METHOD')) {
+ define('PHPUnit_MAIN_METHOD', 'spi_AllTests::main');
+}
+
+require_once 'spi/LoggerLoggingEventTest.php';
+
+class spi_AllTests {
+
+ public static function main() {
+ PHPUnit_TextUI_TestRunner::run(self::suite());
+ }
+
+ public static function suite() {
+ $suite = new
PHPUnit_Framework_TestSuite('log4php.spi');
+
+ $suite->addTestSuite('LoggerLoggingEventTest');
+
+ return $suite;
+ }
+}
+
+if (PHPUnit_MAIN_METHOD == 'spi_AllTests::main') {
+ spi_AllTests::main();
+}
+?>
Modified:
incubator/log4php/trunk/src/test/php/spi/LoggerLoggingEventT
est.php
URL: http://svn.apache.org/v
iewvc/incubator/log4php/trunk/src/test/php/spi/LoggerLogging
EventTest.php?view=diff&rev=556801&r1=556800&r2=
556801
============================================================
==================
---
incubator/log4php/trunk/src/test/php/spi/LoggerLoggingEventT
est.php (original)
+++
incubator/log4php/trunk/src/test/php/spi/LoggerLoggingEventT
est.php Mon Jul 16 20:36:21 2007
 -1
+1,105 
-<?php
/**
* Copyright 1999,2004 The Apache Software
Foundation.
*
* Licensed under the Apache License,
Version 2.0 (the "License");
* you may not use
this file except in compliance with the License.
* You may
obtain a copy of the License at
*
* http://www
.apache.org/licenses/LICENSE-2.0
*
* Unless required
by applicable law or agreed to in writing, software
*
distributed under the License is distributed on an "AS
IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.
* See the License for the
specific language governing permissions and
* limitations
under the License.
*
* category tests
* package
log4php
* subpackage spi
* author Marco Vassura
*
license http://www
.apache.org/licenses/LICENSE-2.0 Apache License, Version
2.0
* version SVN: $Id$
* link http://logging.apac
he.org/log4php
*/
/** */
require_once
'PHPUnit/Framework/TestCase.php';
require_once
LOG4PHP_DIR.'/appenders/LoggerA
ppenderNull.php';
require_once
LOG4PHP_DIR.'/spi/LoggerLoggingEvent.php';
require_once
LOG4PHP_DIR.'/LoggerHierarchy.php';
require_once
LOG4PHP_DIR.'/LoggerLayout.php';
class
LoggerLoggingEventTestCaseAppender extends
LoggerAppenderNull {
protected $requiresLayout =
true;
protected function append($event)
{
$this->layout->format($event);
}
}
class
LoggerLoggingEventTestCaseLayout extends LoggerLayout {
public function activateOptions()
{
return;
}
public function format($event)
{
LoggerLoggingEventTest::$locationInfo =
$event->getLocationInformation();
}
}
class
LoggerLoggingEventTest extends PHPUnit_Framework_TestCase
{
public static $locationInfo;
public function
testConstructWithLoggerName() {
$l = LoggerLevel ::
getLevelDebug();
$e = new LoggerLoggingEvent('fqcn',
'TestLogger', $l,
'test');
$this->assertEquals($e->getLoggerName(),
'TestLogger');
}
public function
testConstructWithTimestamp() {
$l = LoggerLevel ::
getLevelDebug();
$timestamp = microtime(true);
$e = new
LoggerLoggingEvent('fqcn', 'TestLogger', $l, 'test',
$timestamp);
$this->assertEquals($e->getTimeStamp(),
$timestamp);
}
public function testGetStartTime()
{
$time = LoggerLoggingEvent ::
getStartTime();
$this->assertType('float',
$time);
$time2 = LoggerLoggingEvent ::
getStartTime();
$this->assertEquals($time,
$time2);
}
public function testGetLocationInformation()
{
$hierarchy = LoggerHierarchy :: singleton();
$root =
$hierarchy->getRootLogger();
$a = new
LoggerLoggingEventTestCaseAppender('A1');
$a->setLayout
( new LoggerLoggingEventTestCaseLayout()
);
$root->addAppender($a);
$logger =
$hierarchy->getLogger('test');
$line = __LINE__;
$logger->debug('test');
$hierarchy->shutdown();
$li =
self::$locationInfo;
$this->assertEquals($li->get
ClassName(),
get_class($this));
$this->assertEquals($li->getFileN
ame(),
__FILE__);
$this->assertEquals($li->getLineNumber(),
$line);
$this->assert
Equals($li->getMethodName(),
__FUNCTION__);
}
}
?>
No newline at end of file
+<?php
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under
one or more
+ * contributor license agreements. See the NOTICE file
distributed with
+ * this work for additional information regarding copyright
ownership.
+ * The ASF licenses this file to You under the Apache
License, Version 2.0
+ * (the "License"); you may not use this file
except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www
.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in
writing, software
+ * distributed under the License is distributed on an
"AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied.
+ * See the License for the specific language governing
permissions and
+ * limitations under the License.
+ *
+ * category tests
+ * package log4php
+ * subpackage spi
+ * author Marco Vassura
+ * license http://www
.apache.org/licenses/LICENSE-2.0 Apache License, Version
2.0
+ * version SVN: $Id$
+ * link http://logging.apac
he.org/log4php
+ */
+
+/** */
+require_once 'PHPUnit/Framework/TestCase.php';
+
+require_once
LOG4PHP_DIR.'/appenders/LoggerAppenderNull.php';
+require_once LOG4PHP_DIR.'/spi/LoggerLoggingEvent.php';
+require_once LOG4PHP_DIR.'/LoggerHierarchy.php';
+require_once LOG4PHP_DIR.'/LoggerLayout.php';
+
+class LoggerLoggingEventTestCaseAppender extends
LoggerAppenderNull {
+
+ protected $requiresLayout = true;
+
+ protected function append($event) {
+ $this->layout->format($event);
+ }
+
+}
+
+class LoggerLoggingEventTestCaseLayout extends LoggerLayout
{
+
+ public function activateOptions() {
+ return;
+ }
+
+ public function format($event) {
+ LoggerLoggingEventTest::$locationInfo =
$event->getLocationInformation();
+ }
+}
+
+class LoggerLoggingEventTest extends
PHPUnit_Framework_TestCase {
+
+ public static $locationInfo;
+
+ public function testConstructWithLoggerName() {
+ $l = LoggerLevel :: getLevelDebug();
+ $e = new LoggerLoggingEvent('fqcn',
'TestLogger', $l, 'test');
+
$this->assertEquals($e->getLoggerName(),
'TestLogger');
+ }
+
+ public function testConstructWithTimestamp() {
+ $l = LoggerLevel :: getLevelDebug();
+ $timestamp = microtime(true);
+ $e = new LoggerLoggingEvent('fqcn',
'TestLogger', $l, 'test', $timestamp);
+
$this->assertEquals($e->getTimeStamp(), $timestamp);
+ }
+
+ public function testGetStartTime() {
+ $time = LoggerLoggingEvent ::
getStartTime();
+ $this->assertType('float', $time);
+ $time2 = LoggerLoggingEvent ::
getStartTime();
+ $this->assertEquals($time, $time2);
+ }
+
+ public function testGetLocationInformation() {
+ $hierarchy = LoggerHierarchy ::
singleton();
+ $root = $hierarchy->getRootLogger();
+
+ $a = new
LoggerLoggingEventTestCaseAppender('A1');
+ $a->setLayout( new
LoggerLoggingEventTestCaseLayout() );
+ $root->addAppender($a);
+
+ $logger =
$hierarchy->getLogger('test');
+
+ $line = __LINE__;
$logger->debug('test');
+ $hierarchy->shutdown();
+
+ $li = self::$locationInfo;
+
+
$this->assertEquals($li->getClassName(),
get_class($this));
+
$this->assertEquals($li->getFileName(), __FILE__);
+
$this->assertEquals($li->getLineNumber(), $line);
+
$this->assertEquals($li->getMethodName(),
__FUNCTION__);
+
+ }
+
+}
+?>
+
|