| <?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. |
| * |
| * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 |
| * @version //autogentag// |
| * @filesource |
| * @package Debug |
| * @subpackage Tests |
| */ |
| |
| require_once 'Debug/tests/test_classes.php'; |
| |
| /** |
| * @package Debug |
| * @subpackage Tests |
| */ |
| class ezcDebugHtmlFormatterTest extends ezcTestCase |
| { |
| public function testHtml() |
| { |
| $html = new ezcDebugHtmlFormatter(); |
| |
| $struct = new HtmlReporterDataStructures(); |
| |
| $out = $html->generateOutput($struct->getLogStructure(), $struct->getTimeStructure()); |
| $expected = file_get_contents( dirname( __FILE__ ) . '/output/output.html' ); |
| self::assertEquals( $expected, $out ); |
| } |
| |
| public function testHtmlWithPhpStacktrace() |
| { |
| $html = new ezcDebugHtmlFormatter(); |
| |
| $struct = new HtmlReporterDataStructures(); |
| |
| $out = $html->generateOutput( |
| $struct->getLogStructureWithPhpStacktrace(), |
| $struct->getTimeStructure() |
| ); |
| // file_put_contents( dirname( __FILE__ ) . '/output/output_with_php_stacktrace.html', $out ); |
| $expected = file_get_contents( |
| dirname( __FILE__ ) . '/output/output_with_php_stacktrace.html' |
| ); |
| $this->assertEquals( $expected, $out ); |
| } |
| |
| public function testHtmlWithXdebugStacktrace() |
| { |
| $html = new ezcDebugHtmlFormatter(); |
| |
| $struct = new HtmlReporterDataStructures(); |
| |
| $out = $html->generateOutput( |
| $struct->getLogStructureWithXdebugStacktrace(), |
| $struct->getTimeStructure() |
| ); |
| file_put_contents( dirname( __FILE__ ) . '/output/output_with_xdebug_stacktrace.html', $out ); |
| $expected = file_get_contents( |
| dirname( __FILE__ ) . '/output/output_with_xdebug_stacktrace.html' |
| ); |
| $this->assertEquals( $expected, $out ); |
| } |
| |
| public function testSetVerbosityColor() |
| { |
| $html = new ezcDebugHtmlFormatter(); |
| |
| $this->assertAttributeEquals( |
| array(), |
| 'verbosityColors', |
| $html |
| ); |
| |
| $html->setVerbosityColor( 0, 'red' ); |
| |
| $this->assertAttributeEquals( |
| array( |
| 0 => 'red', |
| ), |
| 'verbosityColors', |
| $html |
| ); |
| |
| $html->setVerbosityColor( 23, 'blue' ); |
| |
| $this->assertAttributeEquals( |
| array( |
| 0 => 'red', |
| 23 => 'blue', |
| ), |
| 'verbosityColors', |
| $html |
| ); |
| } |
| |
| public static function suite() |
| { |
| return new PHPUnit_Framework_TestSuite( __CLASS__ ); |
| } |
| } |
| ?> |