You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ih...@apache.org on 2013/11/28 17:04:02 UTC
[32/43] Fixed code formatting to conform to PSR-2
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/appenders/config_invalid_filter_class.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/appenders/config_invalid_filter_class.xml b/tests/resources/configs/appenders/config_invalid_filter_class.xml
index 80c9736..cc9b958 100644
--- a/tests/resources/configs/appenders/config_invalid_filter_class.xml
+++ b/tests/resources/configs/appenders/config_invalid_filter_class.xml
@@ -1,27 +1,27 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php">
- <appender name="foo" class="ConsoleAppender">
- <filter class="stdClass" />
- </appender>
-
- <root>
- <level value="DEBUG" />
- <appender_ref ref="foo" />
- </root>
-</configuration>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<configuration xmlns="http://logging.apache.org/log4php">
+ <appender name="foo" class="ConsoleAppender">
+ <filter class="stdClass" />
+ </appender>
+
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="foo" />
+ </root>
+</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/appenders/config_invalid_filter_parameters.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/appenders/config_invalid_filter_parameters.xml b/tests/resources/configs/appenders/config_invalid_filter_parameters.xml
index d17183d..af23f3e 100644
--- a/tests/resources/configs/appenders/config_invalid_filter_parameters.xml
+++ b/tests/resources/configs/appenders/config_invalid_filter_parameters.xml
@@ -1,29 +1,29 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php">
- <appender name="foo" class="ConsoleAppender">
- <filter class="StringMatchFilter">
- <param name="fooParameter" value="bar" />
- </filter>
- </appender>
-
- <root>
- <level value="DEBUG" />
- <appender_ref ref="foo" />
- </root>
-</configuration>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<configuration xmlns="http://logging.apache.org/log4php">
+ <appender name="foo" class="ConsoleAppender">
+ <filter class="StringMatchFilter">
+ <param name="fooParameter" value="bar" />
+ </filter>
+ </appender>
+
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="foo" />
+ </root>
+</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/appenders/config_invalid_layout_class.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/appenders/config_invalid_layout_class.xml b/tests/resources/configs/appenders/config_invalid_layout_class.xml
index 308243f..4713f72 100644
--- a/tests/resources/configs/appenders/config_invalid_layout_class.xml
+++ b/tests/resources/configs/appenders/config_invalid_layout_class.xml
@@ -1,27 +1,27 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php">
- <appender name="foo" class="ConsoleAppender">
- <layout class="stdClass" />
- </appender>
-
- <root>
- <level value="DEBUG" />
- <appender_ref ref="foo" />
- </root>
-</configuration>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<configuration xmlns="http://logging.apache.org/log4php">
+ <appender name="foo" class="ConsoleAppender">
+ <layout class="stdClass" />
+ </appender>
+
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="foo" />
+ </root>
+</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/appenders/config_no_class.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/appenders/config_no_class.xml b/tests/resources/configs/appenders/config_no_class.xml
index 1e581f3..d0804b0 100644
--- a/tests/resources/configs/appenders/config_no_class.xml
+++ b/tests/resources/configs/appenders/config_no_class.xml
@@ -1,26 +1,26 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
-
- <appender name="foo" />
-
- <root>
- <level value="DEBUG" />
- <appender_ref ref="default" />
- </root>
-</configuration>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
+
+ <appender name="foo" />
+
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="default" />
+ </root>
+</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/appenders/config_no_layout_class.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/appenders/config_no_layout_class.xml b/tests/resources/configs/appenders/config_no_layout_class.xml
index 035226b..bf2df80 100644
--- a/tests/resources/configs/appenders/config_no_layout_class.xml
+++ b/tests/resources/configs/appenders/config_no_layout_class.xml
@@ -1,27 +1,27 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php">
- <appender name="foo" class="ConsoleAppender">
- <layout class="" />
- </appender>
-
- <root>
- <level value="DEBUG" />
- <appender_ref ref="foo" />
- </root>
-</configuration>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<configuration xmlns="http://logging.apache.org/log4php">
+ <appender name="foo" class="ConsoleAppender">
+ <layout class="" />
+ </appender>
+
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="foo" />
+ </root>
+</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/appenders/config_not_existing_class.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/appenders/config_not_existing_class.xml b/tests/resources/configs/appenders/config_not_existing_class.xml
index ec5aae0..6a9a80d 100644
--- a/tests/resources/configs/appenders/config_not_existing_class.xml
+++ b/tests/resources/configs/appenders/config_not_existing_class.xml
@@ -1,25 +1,25 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
- <appender name="foo" class="unknownClass"/>
-
- <root>
- <level value="DEBUG" />
- <appender_ref ref="default" />
- </root>
-</configuration>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
+ <appender name="foo" class="unknownClass"/>
+
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="default" />
+ </root>
+</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/appenders/config_not_existing_filter_class.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/appenders/config_not_existing_filter_class.xml b/tests/resources/configs/appenders/config_not_existing_filter_class.xml
index 1d4e1ea..8be90e6 100644
--- a/tests/resources/configs/appenders/config_not_existing_filter_class.xml
+++ b/tests/resources/configs/appenders/config_not_existing_filter_class.xml
@@ -1,27 +1,27 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php">
- <appender name="foo" class="ConsoleAppender">
- <filter class="Foo" />
- </appender>
-
- <root>
- <level value="DEBUG" />
- <appender_ref ref="foo" />
- </root>
-</configuration>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<configuration xmlns="http://logging.apache.org/log4php">
+ <appender name="foo" class="ConsoleAppender">
+ <filter class="Foo" />
+ </appender>
+
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="foo" />
+ </root>
+</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/appenders/config_not_existing_layout_class.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/appenders/config_not_existing_layout_class.xml b/tests/resources/configs/appenders/config_not_existing_layout_class.xml
index 5fc72a5..dcee56d 100644
--- a/tests/resources/configs/appenders/config_not_existing_layout_class.xml
+++ b/tests/resources/configs/appenders/config_not_existing_layout_class.xml
@@ -1,27 +1,27 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php">
- <appender name="foo" class="ConsoleAppender">
- <layout class="Foo" />
- </appender>
-
- <root>
- <level value="DEBUG" />
- <appender_ref ref="foo" />
- </root>
-</configuration>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<configuration xmlns="http://logging.apache.org/log4php">
+ <appender name="foo" class="ConsoleAppender">
+ <layout class="Foo" />
+ </appender>
+
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="foo" />
+ </root>
+</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/config.yml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/config.yml b/tests/resources/configs/config.yml
index 07b86fb..03803a9 100644
--- a/tests/resources/configs/config.yml
+++ b/tests/resources/configs/config.yml
@@ -1,14 +1,14 @@
-# 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.
+# 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.
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/config1.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/config1.xml b/tests/resources/configs/config1.xml
index 6553c44..bb326a6 100644
--- a/tests/resources/configs/config1.xml
+++ b/tests/resources/configs/config1.xml
@@ -1,54 +1,54 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
- <renderer renderedClass="Fruit" renderingClass="FruitRenderer" />
- <renderer renderedClass="Beer" renderingClass="BeerRenderer" />
- <appender name="default" class="EchoAppender">
- <layout class="LoggerLayoutTTCC"/>
- <filter class="LevelRangeFilter">
- <param name="levelMin" value="ERROR" />
- <param name="levelMax" value="FATAL" />
- <param name="acceptOnMatch" value="false" />
- </filter>
- <filter class="DenyAllFilter" />
- </appender>
- <appender name="file" class="DailyFileAppender" threshold="warn">
- <param name="datePattern" value="Ymd" />
- <param name="file" value="target/examples/daily_%s.log" />
- <layout class="PatternLayout">
- <param name="conversionPattern" value= "%d{ISO8601} [%p] %c: %m (at %F line %L)%n" />
- </layout>
- </appender>
- <logger name="foo.bar.baz" additivity="false">
- <level value="trace" />
- <appender_ref ref="default" />
- </logger>
- <logger name="foo.bar" additivity="true">
- <level value="debug" />
- <appender_ref ref="file" />
- </logger>
- <logger name="foo">
- <level value="warn" />
- <appender_ref ref="default" />
- <appender_ref ref="file" />
- </logger>
- <root>
- <level value="DEBUG" />
- <appender_ref ref="default" />
- </root>
-</configuration>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
+ <renderer renderedClass="Fruit" renderingClass="FruitRenderer" />
+ <renderer renderedClass="Beer" renderingClass="BeerRenderer" />
+ <appender name="default" class="EchoAppender">
+ <layout class="LoggerLayoutTTCC"/>
+ <filter class="LevelRangeFilter">
+ <param name="levelMin" value="ERROR" />
+ <param name="levelMax" value="FATAL" />
+ <param name="acceptOnMatch" value="false" />
+ </filter>
+ <filter class="DenyAllFilter" />
+ </appender>
+ <appender name="file" class="DailyFileAppender" threshold="warn">
+ <param name="datePattern" value="Ymd" />
+ <param name="file" value="target/examples/daily_%s.log" />
+ <layout class="PatternLayout">
+ <param name="conversionPattern" value= "%d{ISO8601} [%p] %c: %m (at %F line %L)%n" />
+ </layout>
+ </appender>
+ <logger name="foo.bar.baz" additivity="false">
+ <level value="trace" />
+ <appender_ref ref="default" />
+ </logger>
+ <logger name="foo.bar" additivity="true">
+ <level value="debug" />
+ <appender_ref ref="file" />
+ </logger>
+ <logger name="foo">
+ <level value="warn" />
+ <appender_ref ref="default" />
+ <appender_ref ref="file" />
+ </logger>
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="default" />
+ </root>
+</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/loggers/config_invalid_additivity.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/loggers/config_invalid_additivity.xml b/tests/resources/configs/loggers/config_invalid_additivity.xml
index 13fe2cc..e6128bd 100644
--- a/tests/resources/configs/loggers/config_invalid_additivity.xml
+++ b/tests/resources/configs/loggers/config_invalid_additivity.xml
@@ -1,30 +1,30 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
- <appender name="default" class="EchoAppender">
- <layout class="SimpleLayout"/>
- </appender>
- <logger name="myLogger" additivity="4711">
- <level value="warn" />
- <appender_ref ref="default" />
- </logger>
- <root>
- <level value="DEBUG" />
- <appender_ref ref="default" />
- </root>
-</configuration>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
+ <appender name="default" class="EchoAppender">
+ <layout class="SimpleLayout"/>
+ </appender>
+ <logger name="myLogger" additivity="4711">
+ <level value="warn" />
+ <appender_ref ref="default" />
+ </logger>
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="default" />
+ </root>
+</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/loggers/config_not_existing_appenders.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/loggers/config_not_existing_appenders.xml b/tests/resources/configs/loggers/config_not_existing_appenders.xml
index 5e5ea1e..3f19039 100644
--- a/tests/resources/configs/loggers/config_not_existing_appenders.xml
+++ b/tests/resources/configs/loggers/config_not_existing_appenders.xml
@@ -1,23 +1,23 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
- <logger name="myLogger">
- <level value="warn" />
- <appender_ref ref="unknownAppender" />
- </logger>
-</configuration>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
+ <logger name="myLogger">
+ <level value="warn" />
+ <appender_ref ref="unknownAppender" />
+ </logger>
+</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/renderers/config_default_renderer.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/renderers/config_default_renderer.xml b/tests/resources/configs/renderers/config_default_renderer.xml
index 5c22323..9bdb545 100644
--- a/tests/resources/configs/renderers/config_default_renderer.xml
+++ b/tests/resources/configs/renderers/config_default_renderer.xml
@@ -1,27 +1,27 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php">
- <appender name="foo" class="ConsoleAppender" />
-
- <defaultRenderer renderingClass="FruitRenderer3" />
-
- <root>
- <level value="DEBUG" />
- <appender_ref ref="foo" />
- </root>
-</configuration>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<configuration xmlns="http://logging.apache.org/log4php">
+ <appender name="foo" class="ConsoleAppender" />
+
+ <defaultRenderer renderingClass="FruitRenderer3" />
+
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="foo" />
+ </root>
+</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/renderers/config_invalid_rendering_class.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/renderers/config_invalid_rendering_class.xml b/tests/resources/configs/renderers/config_invalid_rendering_class.xml
index 51886fe..f722d56 100644
--- a/tests/resources/configs/renderers/config_invalid_rendering_class.xml
+++ b/tests/resources/configs/renderers/config_invalid_rendering_class.xml
@@ -1,29 +1,29 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php">
- <appender name="foo" class="ConsoleAppender">
- <layout class="SimpleLayout"/>
- </appender>
-
- <renderer renderedClass="stdClass" renderingClass="stdClass" />
-
- <root>
- <level value="DEBUG" />
- <appender_ref ref="foo" />
- </root>
-</configuration>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<configuration xmlns="http://logging.apache.org/log4php">
+ <appender name="foo" class="ConsoleAppender">
+ <layout class="SimpleLayout"/>
+ </appender>
+
+ <renderer renderedClass="stdClass" renderingClass="stdClass" />
+
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="foo" />
+ </root>
+</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/renderers/config_no_rendered_class.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/renderers/config_no_rendered_class.xml b/tests/resources/configs/renderers/config_no_rendered_class.xml
index 836815e..209a2ef 100644
--- a/tests/resources/configs/renderers/config_no_rendered_class.xml
+++ b/tests/resources/configs/renderers/config_no_rendered_class.xml
@@ -1,29 +1,29 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php">
- <appender name="foo" class="ConsoleAppender">
- <layout class="SimpleLayout"/>
- </appender>
-
- <renderer renderingClass="DefaultRenderer" />
-
- <root>
- <level value="DEBUG" />
- <appender_ref ref="foo" />
- </root>
-</configuration>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<configuration xmlns="http://logging.apache.org/log4php">
+ <appender name="foo" class="ConsoleAppender">
+ <layout class="SimpleLayout"/>
+ </appender>
+
+ <renderer renderingClass="DefaultRenderer" />
+
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="foo" />
+ </root>
+</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/renderers/config_no_rendering_class.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/renderers/config_no_rendering_class.xml b/tests/resources/configs/renderers/config_no_rendering_class.xml
index 77b14c4..e649b87 100644
--- a/tests/resources/configs/renderers/config_no_rendering_class.xml
+++ b/tests/resources/configs/renderers/config_no_rendering_class.xml
@@ -1,29 +1,29 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php">
- <appender name="foo" class="ConsoleAppender">
- <layout class="SimpleLayout"/>
- </appender>
-
- <renderer />
-
- <root>
- <level value="DEBUG" />
- <appender_ref ref="foo" />
- </root>
-</configuration>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<configuration xmlns="http://logging.apache.org/log4php">
+ <appender name="foo" class="ConsoleAppender">
+ <layout class="SimpleLayout"/>
+ </appender>
+
+ <renderer />
+
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="foo" />
+ </root>
+</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/renderers/config_not_existing_rendering_class.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/renderers/config_not_existing_rendering_class.xml b/tests/resources/configs/renderers/config_not_existing_rendering_class.xml
index 467bd25..0a5502b 100644
--- a/tests/resources/configs/renderers/config_not_existing_rendering_class.xml
+++ b/tests/resources/configs/renderers/config_not_existing_rendering_class.xml
@@ -1,29 +1,29 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php">
- <appender name="foo" class="ConsoleAppender">
- <layout class="SimpleLayout"/>
- </appender>
-
- <renderer renderedClass="stdClass" renderingClass="DoesNotExistRenderer" />
-
- <root>
- <level value="DEBUG" />
- <appender_ref ref="foo" />
- </root>
-</configuration>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<configuration xmlns="http://logging.apache.org/log4php">
+ <appender name="foo" class="ConsoleAppender">
+ <layout class="SimpleLayout"/>
+ </appender>
+
+ <renderer renderedClass="stdClass" renderingClass="DoesNotExistRenderer" />
+
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="foo" />
+ </root>
+</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/AppenderPoolTest.php
----------------------------------------------------------------------
diff --git a/tests/src/AppenderPoolTest.php b/tests/src/AppenderPoolTest.php
index 86ba9d9..9ad8170 100644
--- a/tests/src/AppenderPoolTest.php
+++ b/tests/src/AppenderPoolTest.php
@@ -29,56 +29,58 @@ use Mockery as m;
/**
* @group filters
*/
-class AppenderPoolTest extends \PHPUnit_Framework_TestCase {
-
- public function setUp() {
- AppenderPool::clear();
- }
-
- public function tearDown() {
- AppenderPool::clear();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- * @expectedExceptionMessage log4php: Cannot add unnamed appender to pool.
- */
- public function testAppenderHasNoName() {
-
- $mockAppender = m::mock('Apache\\Log4php\\Appenders\\ConsoleAppender')
- ->shouldReceive('getName')->andReturn('')
- ->shouldReceive('close')
- ->mock();
-
- AppenderPool::add($mockAppender);
- }
-
- public function testAppenderIsAdded() {
-
- $mockAppender = m::mock('Apache\\Log4php\\Appenders\\ConsoleAppender')
- ->shouldReceive('getName')->andReturn('foo')
- ->shouldReceive('close')
- ->mock();
-
- AppenderPool::add($mockAppender);
-
- $expected = 1;
- $actual = count(AppenderPool::getAppenders());
- $this->assertEquals($expected, $actual);
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- * @expectedExceptionMessage log4php: Appender [foo] already exists in pool. Overwriting existing appender.
- */
- public function testDuplicateAppenderName() {
-
- $mockAppender = m::mock('Apache\\Log4php\\Appenders\\ConsoleAppender')
- ->shouldReceive('getName')->andReturn('foo')
- ->shouldReceive('close')
- ->mock();
-
- AppenderPool::add($mockAppender);
- AppenderPool::add($mockAppender);
- }
+class AppenderPoolTest extends \PHPUnit_Framework_TestCase
+{
+ public function setUp()
+ {
+ AppenderPool::clear();
+ }
+
+ public function tearDown()
+ {
+ AppenderPool::clear();
+ }
+
+ /**
+ * @expectedException PHPUnit_Framework_Error
+ * @expectedExceptionMessage log4php: Cannot add unnamed appender to pool.
+ */
+ public function testAppenderHasNoName()
+ {
+ $mockAppender = m::mock('Apache\\Log4php\\Appenders\\ConsoleAppender')
+ ->shouldReceive('getName')->andReturn('')
+ ->shouldReceive('close')
+ ->mock();
+
+ AppenderPool::add($mockAppender);
+ }
+
+ public function testAppenderIsAdded()
+ {
+ $mockAppender = m::mock('Apache\\Log4php\\Appenders\\ConsoleAppender')
+ ->shouldReceive('getName')->andReturn('foo')
+ ->shouldReceive('close')
+ ->mock();
+
+ AppenderPool::add($mockAppender);
+
+ $expected = 1;
+ $actual = count(AppenderPool::getAppenders());
+ $this->assertEquals($expected, $actual);
+ }
+
+ /**
+ * @expectedException PHPUnit_Framework_Error
+ * @expectedExceptionMessage log4php: Appender [foo] already exists in pool. Overwriting existing appender.
+ */
+ public function testDuplicateAppenderName()
+ {
+ $mockAppender = m::mock('Apache\\Log4php\\Appenders\\ConsoleAppender')
+ ->shouldReceive('getName')->andReturn('foo')
+ ->shouldReceive('close')
+ ->mock();
+
+ AppenderPool::add($mockAppender);
+ AppenderPool::add($mockAppender);
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/AppenderTest.php
----------------------------------------------------------------------
diff --git a/tests/src/AppenderTest.php b/tests/src/AppenderTest.php
index d1fe009..1e60a2a 100644
--- a/tests/src/AppenderTest.php
+++ b/tests/src/AppenderTest.php
@@ -34,148 +34,155 @@ use Apache\Log4php\LoggingEvent;
/**
* @group appenders
*/
-class AppenderTest extends \PHPUnit_Framework_TestCase {
-
- public function testThreshold() {
- $appender = new EchoAppender("LoggerAppenderTest");
-
- $layout = new SimpleLayout();
- $appender->setLayout($layout);
-
- $warn = Level::getLevelWarn();
- $appender->setThreshold($warn);
- $appender->activateOptions();
-
- $event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelFatal(), "testmessage");
- ob_start();
- $appender->doAppend($event);
- $v = ob_get_contents();
- ob_end_clean();
- $e = "FATAL - testmessage" . PHP_EOL;
- self::assertEquals($e, $v);
-
- $event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
- ob_start();
- $appender->doAppend($event);
- $v = ob_get_contents();
- ob_end_clean();
- $e = "ERROR - testmessage" . PHP_EOL;
- self::assertEquals($e, $v);
-
- $event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelWarn(), "testmessage");
- ob_start();
- $appender->doAppend($event);
- $v = ob_get_contents();
- ob_end_clean();
- $e = "WARN - testmessage" . PHP_EOL;
- self::assertEquals($e, $v);
-
- $event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelInfo(), "testmessage");
- ob_start();
- $appender->doAppend($event);
- $v = ob_get_contents();
- ob_end_clean();
- $e = "";
- self::assertEquals($e, $v);
-
- $event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelDebug(), "testmessage");
- ob_start();
- $appender->doAppend($event);
- $v = ob_get_contents();
- ob_end_clean();
- $e = "";
- self::assertEquals($e, $v);
+class AppenderTest extends \PHPUnit_Framework_TestCase
+{
+ public function testThreshold()
+ {
+ $appender = new EchoAppender("LoggerAppenderTest");
+
+ $layout = new SimpleLayout();
+ $appender->setLayout($layout);
+
+ $warn = Level::getLevelWarn();
+ $appender->setThreshold($warn);
+ $appender->activateOptions();
+
+ $event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelFatal(), "testmessage");
+ ob_start();
+ $appender->doAppend($event);
+ $v = ob_get_contents();
+ ob_end_clean();
+ $e = "FATAL - testmessage" . PHP_EOL;
+ self::assertEquals($e, $v);
+
+ $event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
+ ob_start();
+ $appender->doAppend($event);
+ $v = ob_get_contents();
+ ob_end_clean();
+ $e = "ERROR - testmessage" . PHP_EOL;
+ self::assertEquals($e, $v);
+
+ $event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelWarn(), "testmessage");
+ ob_start();
+ $appender->doAppend($event);
+ $v = ob_get_contents();
+ ob_end_clean();
+ $e = "WARN - testmessage" . PHP_EOL;
+ self::assertEquals($e, $v);
+
+ $event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelInfo(), "testmessage");
+ ob_start();
+ $appender->doAppend($event);
+ $v = ob_get_contents();
+ ob_end_clean();
+ $e = "";
+ self::assertEquals($e, $v);
+
+ $event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelDebug(), "testmessage");
+ ob_start();
+ $appender->doAppend($event);
+ $v = ob_get_contents();
+ ob_end_clean();
+ $e = "";
+ self::assertEquals($e, $v);
}
- public function testGetThreshold() {
- $appender = new EchoAppender("LoggerAppenderTest");
+ public function testGetThreshold()
+ {
+ $appender = new EchoAppender("LoggerAppenderTest");
- $layout = new SimpleLayout();
- $appender->setLayout($layout);
+ $layout = new SimpleLayout();
+ $appender->setLayout($layout);
- $warn = Level::getLevelWarn();
- $appender->setThreshold($warn);
+ $warn = Level::getLevelWarn();
+ $appender->setThreshold($warn);
- $a = $appender->getThreshold();
- self::assertEquals($warn, $a);
+ $a = $appender->getThreshold();
+ self::assertEquals($warn, $a);
}
- public function testSetStringThreshold() {
- $appender = new EchoAppender("LoggerAppenderTest");
-
- $layout = new SimpleLayout();
- $appender->setLayout($layout);
-
- $warn = Level::getLevelWarn();
- $appender->setThreshold('WARN');
- $a = $appender->getThreshold();
- self::assertEquals($warn, $a);
-
- $e = Level::getLevelFatal();
- $appender->setThreshold('FATAL');
- $a = $appender->getThreshold();
- self::assertEquals($e, $a);
-
- $e = Level::getLevelError();
- $appender->setThreshold('ERROR');
- $a = $appender->getThreshold();
- self::assertEquals($e, $a);
-
- $e = Level::getLevelDebug();
- $appender->setThreshold('DEBUG');
- $a = $appender->getThreshold();
- self::assertEquals($e, $a);
-
- $e = Level::getLevelInfo();
- $appender->setThreshold('INFO');
- $a = $appender->getThreshold();
- self::assertEquals($e, $a);
+ public function testSetStringThreshold()
+ {
+ $appender = new EchoAppender("LoggerAppenderTest");
+
+ $layout = new SimpleLayout();
+ $appender->setLayout($layout);
+
+ $warn = Level::getLevelWarn();
+ $appender->setThreshold('WARN');
+ $a = $appender->getThreshold();
+ self::assertEquals($warn, $a);
+
+ $e = Level::getLevelFatal();
+ $appender->setThreshold('FATAL');
+ $a = $appender->getThreshold();
+ self::assertEquals($e, $a);
+
+ $e = Level::getLevelError();
+ $appender->setThreshold('ERROR');
+ $a = $appender->getThreshold();
+ self::assertEquals($e, $a);
+
+ $e = Level::getLevelDebug();
+ $appender->setThreshold('DEBUG');
+ $a = $appender->getThreshold();
+ self::assertEquals($e, $a);
+
+ $e = Level::getLevelInfo();
+ $appender->setThreshold('INFO');
+ $a = $appender->getThreshold();
+ self::assertEquals($e, $a);
}
- public function testSetFilter() {
- $appender = new EchoAppender("LoggerAppenderTest");
+ public function testSetFilter()
+ {
+ $appender = new EchoAppender("LoggerAppenderTest");
- $layout = new SimpleLayout();
- $appender->setLayout($layout);
+ $layout = new SimpleLayout();
+ $appender->setLayout($layout);
- $filter = new DenyAllFilter();
- $appender->addFilter($filter);
+ $filter = new DenyAllFilter();
+ $appender->addFilter($filter);
- $filter2 = new LevelMatchFilter();
- $appender->addFilter($filter2);
+ $filter2 = new LevelMatchFilter();
+ $appender->addFilter($filter2);
- $first = $appender->getFilter();
- self::assertEquals($first, $filter);
+ $first = $appender->getFilter();
+ self::assertEquals($first, $filter);
- $next = $first->getNext();
- self::assertEquals($next, $filter2);
+ $next = $first->getNext();
+ self::assertEquals($next, $filter2);
- $appender->clearFilters();
- $nullfilter = $appender->getFilter();
- self::assertNull($nullfilter);
+ $appender->clearFilters();
+ $nullfilter = $appender->getFilter();
+ self::assertNull($nullfilter);
}
- public function testInstanciateWithLayout() {
- $appender = new EchoAppender("LoggerAppenderTest");
+ public function testInstanciateWithLayout()
+ {
+ $appender = new EchoAppender("LoggerAppenderTest");
- $expected = "Apache\\Log4php\\Layouts\\SimpleLayout";
- $actual = $appender->getLayout();
- $this->assertInstanceof($expected, $actual);
+ $expected = "Apache\\Log4php\\Layouts\\SimpleLayout";
+ $actual = $appender->getLayout();
+ $this->assertInstanceof($expected, $actual);
}
- public function testOverwriteLayout() {
- $layout = new SimpleLayout();
- $appender = new EchoAppender("LoggerAppenderTest");
- $appender->setLayout($layout);
+ public function testOverwriteLayout()
+ {
+ $layout = new SimpleLayout();
+ $appender = new EchoAppender("LoggerAppenderTest");
+ $appender->setLayout($layout);
- $actual = $appender->getLayout();
- $this->assertEquals($layout, $actual);
+ $actual = $appender->getLayout();
+ $this->assertEquals($layout, $actual);
}
- public function testRequiresNoLayout() {
- $appender = new NullAppender("LoggerAppenderTest");
+ public function testRequiresNoLayout()
+ {
+ $appender = new NullAppender("LoggerAppenderTest");
- $actual = $appender->getLayout();
- $this->assertNull($actual);
+ $actual = $appender->getLayout();
+ $this->assertNull($actual);
}
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/Appenders/ConsoleAppenderTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Appenders/ConsoleAppenderTest.php b/tests/src/Appenders/ConsoleAppenderTest.php
index a99a407..39c75b0 100644
--- a/tests/src/Appenders/ConsoleAppenderTest.php
+++ b/tests/src/Appenders/ConsoleAppenderTest.php
@@ -28,64 +28,68 @@ use Apache\Log4php\Appenders\ConsoleAppender;
/**
* @group appenders
*/
-class ConsoleAppenderTest extends \PHPUnit_Framework_TestCase {
+class ConsoleAppenderTest extends \PHPUnit_Framework_TestCase
+{
+ private $config = array(
+ 'rootLogger' => array(
+ 'appenders' => array('default'),
+ ),
+ 'appenders' => array(
+ 'default' => array(
+ 'class' => 'ConsoleAppender',
+ 'layout' => array(
+ 'class' => 'PatternLayout',
+ 'params' => array(
+ // Intentionally blank so output doesn't clutter phpunit output
+ 'conversionPattern' => ''
+ )
+ ),
+ )
+ )
+ );
- private $config = array(
- 'rootLogger' => array(
- 'appenders' => array('default'),
- ),
- 'appenders' => array(
- 'default' => array(
- 'class' => 'ConsoleAppender',
- 'layout' => array(
- 'class' => 'PatternLayout',
- 'params' => array(
- // Intentionally blank so output doesn't clutter phpunit output
- 'conversionPattern' => ''
- )
- ),
- )
- )
- );
-
- public function testRequiresLayout() {
- $appender = new ConsoleAppender();
- self::assertTrue($appender->requiresLayout());
- }
+ public function testRequiresLayout()
+ {
+ $appender = new ConsoleAppender();
+ self::assertTrue($appender->requiresLayout());
+ }
- public function testAppendDefault() {
- Logger::configure($this->config);
- $log = Logger::getRootLogger();
+ public function testAppendDefault()
+ {
+ Logger::configure($this->config);
+ $log = Logger::getRootLogger();
- $expected = ConsoleAppender::STDOUT;
- $actual = $log->getAppender('default')->getTarget();
- $this->assertSame($expected, $actual);
+ $expected = ConsoleAppender::STDOUT;
+ $actual = $log->getAppender('default')->getTarget();
+ $this->assertSame($expected, $actual);
- $log->info("hello");
+ $log->info("hello");
}
- public function testAppendStdout() {
- $this->config['appenders']['default']['params']['target'] = 'stdout';
+ public function testAppendStdout()
+ {
+ $this->config['appenders']['default']['params']['target'] = 'stdout';
- Logger::configure($this->config);
- $log = Logger::getRootLogger();
+ Logger::configure($this->config);
+ $log = Logger::getRootLogger();
- $expected = ConsoleAppender::STDOUT;
- $actual = $log->getAppender('default')->getTarget();
- $this->assertSame($expected, $actual);
+ $expected = ConsoleAppender::STDOUT;
+ $actual = $log->getAppender('default')->getTarget();
+ $this->assertSame($expected, $actual);
- $log->info("hello");
+ $log->info("hello");
}
- public function testAppendStderr() {
- $this->config['appenders']['default']['params']['target'] = 'stderr';
- Logger::configure($this->config);
- $log = Logger::getRootLogger();
- $expected = ConsoleAppender::STDERR;
+ public function testAppendStderr()
+ {
+ $this->config['appenders']['default']['params']['target'] = 'stderr';
+ Logger::configure($this->config);
+ $log = Logger::getRootLogger();
+ $expected = ConsoleAppender::STDERR;
- $actual = $log->getAppender('default')->getTarget();
- $this->assertSame($expected, $actual);
+ $actual = $log->getAppender('default')->getTarget();
+ $this->assertSame($expected, $actual);
- $log->info("hello");
+ $log->info("hello");
}
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/Appenders/DailyFileAppenderTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Appenders/DailyFileAppenderTest.php b/tests/src/Appenders/DailyFileAppenderTest.php
index e5f3acf..a9ad0cf 100644
--- a/tests/src/Appenders/DailyFileAppenderTest.php
+++ b/tests/src/Appenders/DailyFileAppenderTest.php
@@ -30,165 +30,175 @@ use Apache\Log4php\Tests\TestHelper;
/**
* @group appenders
*/
-class DailyFileAppenderTest extends \PHPUnit_Framework_TestCase {
-
- protected function setUp() {
- @unlink(PHPUNIT_TEMP_DIR . '/TEST-daily.txt.' . date('Ymd'));
- @unlink(PHPUNIT_TEMP_DIR . '/TEST-daily.txt.' . date('Y'));
- }
-
- public function testRequiresLayout() {
- $appender = new DailyFileAppender();
- self::assertTrue($appender->requiresLayout());
- }
-
- public function testDefaultLayout() {
- $appender = new DailyFileAppender();
- $actual = $appender->getLayout();
- self::assertInstanceOf('Apache\\Log4php\\Layouts\\SimpleLayout', $actual);
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- * @expectedExceptionMessage Required parameter 'file' not set.
- */
- public function testRequiredParamWarning1() {
- $appender = new DailyFileAppender();
- $appender->activateOptions();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- * @expectedExceptionMessage Required parameter 'datePattern' not set.
- */
- public function testRequiredParamWarning2() {
- $appender = new DailyFileAppender();
- $appender->setFile('file.log');
- $appender->setDatePattern('');
- $appender->activateOptions();
- }
-
- public function testGetDatePattern() {
- $appender = new DailyFileAppender();
-
- // Default pattern
- $actual = $appender->getDatePattern();
- self::assertEquals('Ymd', $actual);
-
- // Custom pattern
- $appender->setDatePattern('xyz');
- $actual = $appender->getDatePattern();
- self::assertEquals('xyz', $actual);
- }
-
- /**
- * For greater code coverage!
- * Override the warning so remaining code is reached.
- */
- public function testRequiredParamWarning3() {
- $appender = new DailyFileAppender();
- $appender->setFile('file.log');
- $appender->setDatePattern('');
- @$appender->activateOptions();
- }
-
- public function testLazyFileOpen() {
- $event = TestHelper::getWarnEvent("my message");
- $file = PHPUNIT_TEMP_DIR . '/lazy-file.%s.log';
- $pattern = 'Y-m-d';
-
- $date = date($pattern, $event->getTimeStamp());
- $path = PHPUNIT_TEMP_DIR . "/lazy-file.$date.log";
-
- if (file_exists($path)) {
- unlink($path);
- }
-
- $appender = new DailyFileAppender();
- $appender->setFile($file);
- $appender->setDatePattern('Y-m-d');
- $appender->activateOptions();
-
- // File should not exist before first append
- self::assertFileNotExists($path);
- $appender->append($event);
- self::assertFileExists($path);
- }
-
- public function testRollover()
- {
- $message = uniqid();
- $level = Level::getLevelDebug();
-
- $file = PHPUNIT_TEMP_DIR . '/lazy-file.%s.log';
- $pattern = 'Y-m-d';
-
- // Get some timestamps for events - different date for each
- $ts1 = mktime(10, 0, 0, 7, 3, 1980);
- $ts2 = mktime(10, 0, 0, 7, 4, 1980);
- $ts3 = mktime(10, 0, 0, 7, 5, 1980);
-
- $e1 = new LoggingEvent(__CLASS__, 'test', $level, $message, $ts1);
- $e2 = new LoggingEvent(__CLASS__, 'test', $level, $message, $ts2);
- $e3 = new LoggingEvent(__CLASS__, 'test', $level, $message, $ts3);
-
- // Expected paths
- $path1 = PHPUNIT_TEMP_DIR . '/lazy-file.1980-07-03.log';
- $path2 = PHPUNIT_TEMP_DIR . '/lazy-file.1980-07-04.log';
- $path3 = PHPUNIT_TEMP_DIR . '/lazy-file.1980-07-05.log';
-
- @unlink($path1);
- @unlink($path2);
- @unlink($path3);
-
- $appender = new DailyFileAppender();
- $appender->setFile($file);
- $appender->setDatePattern('Y-m-d');
- $appender->activateOptions();
-
- $appender->append($e1);
- $appender->append($e2);
- $appender->append($e3);
-
- $actual1 = file_get_contents($path1);
- $actual2 = file_get_contents($path2);
- $actual3 = file_get_contents($path3);
-
- $expected1 = "DEBUG - $message" . PHP_EOL;
- $expected2 = "DEBUG - $message" . PHP_EOL;
- $expected3 = "DEBUG - $message" . PHP_EOL;
-
- self::assertSame($expected1, $actual1);
- self::assertSame($expected2, $actual2);
- self::assertSame($expected3, $actual3);
- }
-
- public function testSimpleLogging() {
- $event = TestHelper::getWarnEvent("my message");
-
- $appender = new DailyFileAppender();
- $appender->setFile(PHPUNIT_TEMP_DIR . '/TEST-daily.txt.%s');
- $appender->activateOptions();
- $appender->append($event);
- $appender->close();
-
- $actual = file_get_contents(PHPUNIT_TEMP_DIR . '/TEST-daily.txt.' . date("Ymd"));
- $expected = "WARN - my message".PHP_EOL;
- self::assertEquals($expected, $actual);
- }
-
- public function testChangedDateFormat() {
- $event = TestHelper::getWarnEvent("my message");
-
- $appender = new DailyFileAppender();
- $appender->setDatePattern('Y');
- $appender->setFile(PHPUNIT_TEMP_DIR . '/TEST-daily.txt.%s');
- $appender->activateOptions();
- $appender->append($event);
- $appender->close();
-
- $actual = file_get_contents(PHPUNIT_TEMP_DIR . '/TEST-daily.txt.' . date("Y"));
- $expected = "WARN - my message".PHP_EOL;
- self::assertEquals($expected, $actual);
- }
+class DailyFileAppenderTest extends \PHPUnit_Framework_TestCase
+{
+ protected function setUp()
+ {
+ @unlink(PHPUNIT_TEMP_DIR . '/TEST-daily.txt.' . date('Ymd'));
+ @unlink(PHPUNIT_TEMP_DIR . '/TEST-daily.txt.' . date('Y'));
+ }
+
+ public function testRequiresLayout()
+ {
+ $appender = new DailyFileAppender();
+ self::assertTrue($appender->requiresLayout());
+ }
+
+ public function testDefaultLayout()
+ {
+ $appender = new DailyFileAppender();
+ $actual = $appender->getLayout();
+ self::assertInstanceOf('Apache\\Log4php\\Layouts\\SimpleLayout', $actual);
+ }
+
+ /**
+ * @expectedException PHPUnit_Framework_Error
+ * @expectedExceptionMessage Required parameter 'file' not set.
+ */
+ public function testRequiredParamWarning1()
+ {
+ $appender = new DailyFileAppender();
+ $appender->activateOptions();
+ }
+
+ /**
+ * @expectedException PHPUnit_Framework_Error
+ * @expectedExceptionMessage Required parameter 'datePattern' not set.
+ */
+ public function testRequiredParamWarning2()
+ {
+ $appender = new DailyFileAppender();
+ $appender->setFile('file.log');
+ $appender->setDatePattern('');
+ $appender->activateOptions();
+ }
+
+ public function testGetDatePattern()
+ {
+ $appender = new DailyFileAppender();
+
+ // Default pattern
+ $actual = $appender->getDatePattern();
+ self::assertEquals('Ymd', $actual);
+
+ // Custom pattern
+ $appender->setDatePattern('xyz');
+ $actual = $appender->getDatePattern();
+ self::assertEquals('xyz', $actual);
+ }
+
+ /**
+ * For greater code coverage!
+ * Override the warning so remaining code is reached.
+ */
+ public function testRequiredParamWarning3()
+ {
+ $appender = new DailyFileAppender();
+ $appender->setFile('file.log');
+ $appender->setDatePattern('');
+ @$appender->activateOptions();
+ }
+
+ public function testLazyFileOpen()
+ {
+ $event = TestHelper::getWarnEvent("my message");
+ $file = PHPUNIT_TEMP_DIR . '/lazy-file.%s.log';
+ $pattern = 'Y-m-d';
+
+ $date = date($pattern, $event->getTimeStamp());
+ $path = PHPUNIT_TEMP_DIR . "/lazy-file.$date.log";
+
+ if (file_exists($path)) {
+ unlink($path);
+ }
+
+ $appender = new DailyFileAppender();
+ $appender->setFile($file);
+ $appender->setDatePattern('Y-m-d');
+ $appender->activateOptions();
+
+ // File should not exist before first append
+ self::assertFileNotExists($path);
+ $appender->append($event);
+ self::assertFileExists($path);
+ }
+
+ public function testRollover()
+ {
+ $message = uniqid();
+ $level = Level::getLevelDebug();
+
+ $file = PHPUNIT_TEMP_DIR . '/lazy-file.%s.log';
+ $pattern = 'Y-m-d';
+
+ // Get some timestamps for events - different date for each
+ $ts1 = mktime(10, 0, 0, 7, 3, 1980);
+ $ts2 = mktime(10, 0, 0, 7, 4, 1980);
+ $ts3 = mktime(10, 0, 0, 7, 5, 1980);
+
+ $e1 = new LoggingEvent(__CLASS__, 'test', $level, $message, $ts1);
+ $e2 = new LoggingEvent(__CLASS__, 'test', $level, $message, $ts2);
+ $e3 = new LoggingEvent(__CLASS__, 'test', $level, $message, $ts3);
+
+ // Expected paths
+ $path1 = PHPUNIT_TEMP_DIR . '/lazy-file.1980-07-03.log';
+ $path2 = PHPUNIT_TEMP_DIR . '/lazy-file.1980-07-04.log';
+ $path3 = PHPUNIT_TEMP_DIR . '/lazy-file.1980-07-05.log';
+
+ @unlink($path1);
+ @unlink($path2);
+ @unlink($path3);
+
+ $appender = new DailyFileAppender();
+ $appender->setFile($file);
+ $appender->setDatePattern('Y-m-d');
+ $appender->activateOptions();
+
+ $appender->append($e1);
+ $appender->append($e2);
+ $appender->append($e3);
+
+ $actual1 = file_get_contents($path1);
+ $actual2 = file_get_contents($path2);
+ $actual3 = file_get_contents($path3);
+
+ $expected1 = "DEBUG - $message" . PHP_EOL;
+ $expected2 = "DEBUG - $message" . PHP_EOL;
+ $expected3 = "DEBUG - $message" . PHP_EOL;
+
+ self::assertSame($expected1, $actual1);
+ self::assertSame($expected2, $actual2);
+ self::assertSame($expected3, $actual3);
+ }
+
+ public function testSimpleLogging()
+ {
+ $event = TestHelper::getWarnEvent("my message");
+
+ $appender = new DailyFileAppender();
+ $appender->setFile(PHPUNIT_TEMP_DIR . '/TEST-daily.txt.%s');
+ $appender->activateOptions();
+ $appender->append($event);
+ $appender->close();
+
+ $actual = file_get_contents(PHPUNIT_TEMP_DIR . '/TEST-daily.txt.' . date("Ymd"));
+ $expected = "WARN - my message".PHP_EOL;
+ self::assertEquals($expected, $actual);
+ }
+
+ public function testChangedDateFormat()
+ {
+ $event = TestHelper::getWarnEvent("my message");
+
+ $appender = new DailyFileAppender();
+ $appender->setDatePattern('Y');
+ $appender->setFile(PHPUNIT_TEMP_DIR . '/TEST-daily.txt.%s');
+ $appender->activateOptions();
+ $appender->append($event);
+ $appender->close();
+
+ $actual = file_get_contents(PHPUNIT_TEMP_DIR . '/TEST-daily.txt.' . date("Y"));
+ $expected = "WARN - my message".PHP_EOL;
+ self::assertEquals($expected, $actual);
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/Appenders/EchoAppenderTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Appenders/EchoAppenderTest.php b/tests/src/Appenders/EchoAppenderTest.php
index 57f2c12..a2daf1f 100644
--- a/tests/src/Appenders/EchoAppenderTest.php
+++ b/tests/src/Appenders/EchoAppenderTest.php
@@ -31,140 +31,144 @@ use Apache\Log4php\LoggingEvent;
/**
* @group appenders
*/
-class EchoAppenderTest extends \PHPUnit_Framework_TestCase {
-
- private $config1 = array(
- 'rootLogger' => array(
- 'appenders' => array('default'),
- ),
- 'appenders' => array(
- 'default' => array(
- 'class' => 'EchoAppender',
- 'layout' => array(
- 'class' => 'SimpleLayout'
- ),
- )
- )
- );
-
- private $config2 = array(
- 'rootLogger' => array(
- 'appenders' => array('default'),
- ),
- 'appenders' => array(
- 'default' => array(
- 'class' => 'EchoAppender',
- 'layout' => array(
- 'class' => 'SimpleLayout'
- ),
- 'params' => array(
- 'htmlLineBreaks' => true
- )
- )
- )
- );
-
- private $config3 = array(
- 'rootLogger' => array(
- 'appenders' => array('default'),
- ),
- 'appenders' => array(
- 'default' => array(
- 'class' => 'EchoAppender',
- 'layout' => array(
- 'class' => 'SimpleLayout'
- ),
- 'params' => array(
- 'htmlLineBreaks' => 'foo'
- )
- )
- )
- );
-
- public function testAppend() {
- Logger::configure($this->config1);
- $log = Logger::getRootLogger();
-
- $hlb = $log->getAppender('default')->getHtmlLineBreaks();
- $this->assertSame(false, $hlb);
-
- ob_start();
- $log->info("This is a test");
- $log->debug("And this too");
- $actual = ob_get_clean();
- $expected = "INFO - This is a test" . PHP_EOL . "DEBUG - And this too". PHP_EOL;
-
- $this->assertSame($expected, $actual);
- }
-
- public function testHtmlLineBreaks() {
- Logger::configure($this->config2);
- $log = Logger::getRootLogger();
-
- $hlb = $log->getAppender('default')->getHtmlLineBreaks();
- $this->assertSame(true, $hlb);
-
- ob_start();
- $log->info("This is a test" . PHP_EOL . "With more than one line");
- $log->debug("And this too");
- $actual = ob_get_clean();
- $expected = "INFO - This is a test<br />" . PHP_EOL . "With more than one line<br />" . PHP_EOL . "DEBUG - And this too<br />" . PHP_EOL;
-
- $this->assertSame($expected, $actual);
- }
+class EchoAppenderTest extends \PHPUnit_Framework_TestCase
+{
+ private $config1 = array(
+ 'rootLogger' => array(
+ 'appenders' => array('default'),
+ ),
+ 'appenders' => array(
+ 'default' => array(
+ 'class' => 'EchoAppender',
+ 'layout' => array(
+ 'class' => 'SimpleLayout'
+ ),
+ )
+ )
+ );
+
+ private $config2 = array(
+ 'rootLogger' => array(
+ 'appenders' => array('default'),
+ ),
+ 'appenders' => array(
+ 'default' => array(
+ 'class' => 'EchoAppender',
+ 'layout' => array(
+ 'class' => 'SimpleLayout'
+ ),
+ 'params' => array(
+ 'htmlLineBreaks' => true
+ )
+ )
+ )
+ );
+
+ private $config3 = array(
+ 'rootLogger' => array(
+ 'appenders' => array('default'),
+ ),
+ 'appenders' => array(
+ 'default' => array(
+ 'class' => 'EchoAppender',
+ 'layout' => array(
+ 'class' => 'SimpleLayout'
+ ),
+ 'params' => array(
+ 'htmlLineBreaks' => 'foo'
+ )
+ )
+ )
+ );
+
+ public function testAppend()
+ {
+ Logger::configure($this->config1);
+ $log = Logger::getRootLogger();
+
+ $hlb = $log->getAppender('default')->getHtmlLineBreaks();
+ $this->assertSame(false, $hlb);
+
+ ob_start();
+ $log->info("This is a test");
+ $log->debug("And this too");
+ $actual = ob_get_clean();
+ $expected = "INFO - This is a test" . PHP_EOL . "DEBUG - And this too". PHP_EOL;
+
+ $this->assertSame($expected, $actual);
+ }
+
+ public function testHtmlLineBreaks()
+ {
+ Logger::configure($this->config2);
+ $log = Logger::getRootLogger();
+
+ $hlb = $log->getAppender('default')->getHtmlLineBreaks();
+ $this->assertSame(true, $hlb);
+
+ ob_start();
+ $log->info("This is a test" . PHP_EOL . "With more than one line");
+ $log->debug("And this too");
+ $actual = ob_get_clean();
+ $expected = "INFO - This is a test<br />" . PHP_EOL . "With more than one line<br />" . PHP_EOL . "DEBUG - And this too<br />" . PHP_EOL;
+
+ $this->assertSame($expected, $actual);
+ }
// public function testHtmlLineBreaksInvalidOption() {
// Logger::configure($this->config3);
// }
-
- public function testEcho() {
- $appender = new EchoAppender("myname ");
-
- $layout = new SimpleLayout();
- $appender->setLayout($layout);
- $appender->activateOptions();
- $event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
-
- $expected = "ERROR - testmessage" . PHP_EOL;
- ob_start();
- $appender->append($event);
- $actual = ob_get_clean();
-
- self::assertEquals($expected, $actual);
- }
-
- public function testRequiresLayout() {
- $appender = new EchoAppender();
- self::assertTrue($appender->requiresLayout());
- }
-
- public function testEchoHtml() {
- $appender = new EchoAppender("myname ");
- $appender->setHtmlLineBreaks(true);
-
- $layout = new SimpleLayout();
- $appender->setLayout($layout);
- $appender->activateOptions();
-
- // Single line message
- $event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
-
- $expected = "ERROR - testmessage<br />" . PHP_EOL;
- ob_start();
- $appender->append($event);
- $actual = ob_get_clean();
- self::assertEquals($expected, $actual);
-
- // Multi-line message
- $msg = "This message\nis in several lines\r\nto test various line breaks.";
- $expected = "ERROR - This message<br />\nis in several lines<br />\r\nto test various line breaks.<br />" . PHP_EOL;
-
- $event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), $msg);
- ob_start();
- $appender->append($event);
- $actual = ob_get_clean();
- self::assertEquals($expected, $actual);
- }
+ public function testEcho()
+ {
+ $appender = new EchoAppender("myname ");
+
+ $layout = new SimpleLayout();
+ $appender->setLayout($layout);
+ $appender->activateOptions();
+ $event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
+
+ $expected = "ERROR - testmessage" . PHP_EOL;
+ ob_start();
+ $appender->append($event);
+ $actual = ob_get_clean();
+
+ self::assertEquals($expected, $actual);
+ }
+
+ public function testRequiresLayout()
+ {
+ $appender = new EchoAppender();
+ self::assertTrue($appender->requiresLayout());
+ }
+
+ public function testEchoHtml()
+ {
+ $appender = new EchoAppender("myname ");
+ $appender->setHtmlLineBreaks(true);
+
+ $layout = new SimpleLayout();
+ $appender->setLayout($layout);
+ $appender->activateOptions();
+
+ // Single line message
+ $event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
+
+ $expected = "ERROR - testmessage<br />" . PHP_EOL;
+ ob_start();
+ $appender->append($event);
+ $actual = ob_get_clean();
+ self::assertEquals($expected, $actual);
+
+ // Multi-line message
+ $msg = "This message\nis in several lines\r\nto test various line breaks.";
+ $expected = "ERROR - This message<br />\nis in several lines<br />\r\nto test various line breaks.<br />" . PHP_EOL;
+
+ $event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), $msg);
+ ob_start();
+ $appender->append($event);
+ $actual = ob_get_clean();
+ self::assertEquals($expected, $actual);
+ }
}