Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

@thedae: VisualPHPUnit

- Coverage report for multiple files
  • Loading branch information...
commit e4ead590abdf5362197122dc154eaaffa1d4018e 1 parent fc34f51
@thedae authored
View
21 libs/PHPUnit-3.5.0/VisualPHPUnit/VPU.php
@@ -679,6 +679,7 @@ public function coverageReport( $results )
$coverage_files = CoverageAnalysis::getFiles();
foreach ( $coverage_files as $file )
{
+ $coverage_report = '';
$file_contents = file( $file );
$lines_executed = array();
@@ -695,7 +696,7 @@ public function coverageReport( $results )
}
}
- $line_number = 1;
+ $source_code = '';
foreach ( $file_contents as $line_number => $line )
{
$used = '';
@@ -707,17 +708,19 @@ public function coverageReport( $results )
{
$used = '1';
}
- $buffer .= $line;
-
- $line_number++;
+ $source_code .= $line;
}
+
+ ob_start();
+ include 'ui/coverage.html';
+ $coverage_report = ob_get_contents();
+ ob_end_clean();
+
+ $buffer .= $coverage_report;
}
- ob_start();
- include 'ui/coverage.html';
- $coverage_report = ob_get_contents();
- ob_end_clean();
- return $coverage_report;
+
+ return $buffer;
}
/**
View
2  libs/PHPUnit-3.5.0/VisualPHPUnit/ui/coverage.html
@@ -1,6 +1,6 @@
<div>
<pre class="brush: php; highlight-red: [10,20]; highlight: [<?php echo implode( ',', $lines_executed ); ?>];">
- <?php echo $buffer; ?>
+ <?php echo $source_code; ?>
</pre>
</div>
<script type="text/javascript">SyntaxHighlighter.all();</script>
View
82 tests/libs/SEOframework/CacheDiskTest.php
@@ -1,14 +1,12 @@
<?php
-ini_set("include_path", "../libs/SEOframework".PATH_SEPARATOR."../../../libs/SEOframework".PATH_SEPARATOR.ini_get("include_path"));
-require_once 'PHPUnit/Framework.php';
-require_once '/var/www/seoframework/libs/SEOframework/Cache.php';
+CoverageAnalysis::add( ROOT_PATH . '/libs/SEOframework/CacheDisk.php' );
/**
* Test class for CacheDisk.
* Generated by PHPUnit on 2009-11-01 at 12:17:06.
*/
-class CacheDiskTest extends PHPUnit_Framework_TestCase
+class CacheDiskTest extends PHPUnit_Extensions_ControllerTest
{
/**
* @var CacheDisk
@@ -21,7 +19,7 @@ class CacheDiskTest extends PHPUnit_Framework_TestCase
*/
protected function setUp()
{
- $this->object = new CacheDisk;
+ $this->object = $this->getProxyClass( 'CacheDisk' );
}
/**
@@ -30,61 +28,27 @@ protected function setUp()
*/
protected function tearDown()
{
+ $this->object = null;
}
- /**
- * @todo Implement testSingleton().
- */
- public function testSingleton()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @todo Implement testSet().
- */
- public function testSet()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @todo Implement testGet().
- */
- public function testGet()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @todo Implement testHasExpired().
- */
- public function testHasExpired()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @todo Implement testDelete().
- */
- public function testDelete()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
+ /**
+ * Test object correct creation.
+ */
+ public function testObjectCreation()
+ {
+ $this->assertTrue( $this->object instanceof CacheDisk );
+ }
+
+ /**
+ * Test singleton.
+ */
+ public function testGetInstance()
+ {
+ $object = CacheDisk::singleton();
+ $this->assertTrue( $object instanceof CacheDisk );
+
+ $singleton = CacheDisk::singleton();
+ $this->assertEquals( $object, $singleton );
+ }
}
?>
Please sign in to comment.
Something went wrong with that request. Please try again.