fixed a couple more bugs, noted another, and committed a few tests
This commit is contained in:
parent
725d847ce9
commit
1fcbc8a8b9
@ -34,7 +34,9 @@
|
||||
|
||||
public static function filter(array $data) {
|
||||
foreach ($data as $file => $arr) {
|
||||
if (in_array($file, self::$files)) {
|
||||
if (strpos($file, ' : runtime-created function') !== false) {
|
||||
unset($data[$file]);
|
||||
} else if (in_array($file, self::$files)) {
|
||||
unset($data[$file]);
|
||||
} else {
|
||||
foreach (self::$directories as $dir) {
|
||||
|
@ -288,6 +288,10 @@
|
||||
return file_put_contents($newFile, $template);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo If there are no files in the root directory (e.g. only directories)
|
||||
* then index.html does not get generated
|
||||
*/
|
||||
private static function writeHtmlDirectories($coverageDir, $baseDir, array $coverageData, $renderer) {
|
||||
$dirData = array();
|
||||
foreach ($coverageData as $file => $data) {
|
||||
@ -400,6 +404,7 @@
|
||||
$template
|
||||
);
|
||||
|
||||
//echo $dir . "\n";
|
||||
$fileName = ($dir === DIRECTORY_SEPARATOR) ? 'index.html' : str_replace(DIRECTORY_SEPARATOR, '-', $dir) . '.html';
|
||||
file_put_contents($coverageDir . DIRECTORY_SEPARATOR . $fileName, $temp);
|
||||
}
|
||||
|
@ -254,9 +254,6 @@
|
||||
}
|
||||
|
||||
public static function getClassNamesFromFile($file) {
|
||||
if (!is_file($file)) {
|
||||
return array();
|
||||
}
|
||||
$tokens = token_get_all(file_get_contents($file));
|
||||
$classes = array();
|
||||
for ($i = 0, $len = count($tokens); $i < $len; $i++) {
|
||||
|
14
tests/AllTests.php
Normal file
14
tests/AllTests.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
class AllTests extends TestSuite {
|
||||
|
||||
public function __construct() {
|
||||
CoverageFilter::clear();
|
||||
CoverageFilter::addDirectory(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . Product::NAME . DIRECTORY_SEPARATOR . 'external');
|
||||
|
||||
parent::__construct('All Testify Tests', TestAccumulator::getTestsFromDir(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Testify'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
65
tests/Testify/util/UtilTest.php
Normal file
65
tests/Testify/util/UtilTest.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
class UtilTest extends TestCase {
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function exportObject() {
|
||||
Assert::equal('stdClass', Util::export(new stdClass()));
|
||||
Assert::equal(get_class($this), Util::export($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function exportString() {
|
||||
Assert::equal('"foo"', Util::export('foo'));
|
||||
Assert::equal('"foofoofoof...ofoofoofoo"', Util::export('foofoofoofoofoofoofoofoofoo'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function exportDouble() {
|
||||
Assert::equal(10.7, Util::export(10.7));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function exportNull() {
|
||||
Assert::equal('NULL', Util::export(null));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function exportInteger() {
|
||||
Assert::equal(10, Util::export(10));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function exportBoolean() {
|
||||
Assert::equal('true', Util::export(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function exportResource() {
|
||||
Assert::equal('resource of type xml', Util::export(xml_parser_create()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function exportArray() {
|
||||
Assert::equal('array[3]', Util::export(array(1,2,3)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user