Example #1
0
/*
 * This file is part of the sfDoctrine package.
 * (c) 2006 Olivier Verdier <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
/**
 * @package    symfony.plugins
 * @subpackage sfDoctrine
 * @author     Pavel Kunc
 * @author     Olivier Verdier <*****@*****.**>
 * @version    SVN: $Id: coverage.php 2690 2006-11-15 18:35:07Z chtito $
 */
$testsDir = realpath(dirname(__FILE__));
define('SF_ROOT_DIR', realpath($testsDir . '/../../../'));
// symfony directories
require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
require_once $sf_symfony_lib_dir . '/vendor/lime/lime.php';
$h = new lime_harness(new lime_output_color());
$h->base_dir = dirname(__FILE__);
// unit tests
$h->register_glob($h->base_dir . '/unit/*/*Test.php');
// functional tests
$h->register_glob($h->base_dir . '/functional/*Test.php');
$c = new lime_coverage($h);
$c->extension = '.class.php';
$c->verbose = false;
$c->base_dir = realpath(dirname(__FILE__) . '/../lib');
$c->register_glob($c->base_dir . '/*/*.php');
$c->run();
Example #2
0
<?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
define('SYMFONY_LIB_DIR', realpath(dirname(__FILE__) . '/../../../..'));
require SYMFONY_LIB_DIR . '/vendor/lime/lime.php';
require SYMFONY_LIB_DIR . '/util/sfFinder.class.php';
$h = new lime_harness(new lime_output_color());
$h->base_dir = realpath(dirname(__FILE__) . '/..');
// unit tests
$h->register_glob($h->base_dir . '/unit/*/*Test.php');
$h->register_glob($h->base_dir . '/unit/*/*/*Test.php');
// functional tests
$h->register_glob($h->base_dir . '/functional/*Test.php');
$h->register_glob($h->base_dir . '/functional/*/*Test.php');
$c = new lime_coverage($h);
$c->extension = '.class.php';
$c->verbose = false;
$c->base_dir = realpath(dirname(__FILE__) . '/../lib');
$finder = sfFinder::type('file')->name('*.php')->prune('vendor')->prune('test')->prune('data');
$c->register($finder->in($c->base_dir));
$c->run();
Example #3
0
<?php

$root_dir = realpath(dirname(__FILE__) . '/../..');
require_once $root_dir . '/lib/vendor/lime/lime.php';
require_once $root_dir . '/lib/util/sfFinder.class.php';
require_once $root_dir . '/lib/autoload/sfCoreAutoload.class.php';
$version = SYMFONY_VERSION;
printf("symfony LOC (%s)\n", $version);
printf("==============%s\n\n", str_repeat('=', strlen($version)));
// symfony core LOC
$total_loc = 0;
$files = sfFinder::type('file')->name('*.php')->prune('vendor', 'plugins')->in($root_dir . '/lib');
foreach ($files as $file) {
    $total_loc += count(lime_coverage::get_php_lines($file));
}
$files = sfFinder::type('file')->name('*.php')->prune('vendor')->in($root_dir . '/lib/plugins/*/lib');
foreach ($files as $file) {
    $total_loc += count(lime_coverage::get_php_lines($file));
}
// symfony tests LOC
$total_tests_loc = 0;
$files = sfFinder::type('file')->name('*Test.php')->in(array($root_dir . '/lib/plugins/sfCompat10Plugin/test/unit', $root_dir . '/lib/plugins/sfCompat10Plugin/test/functional', $root_dir . '/lib/plugins/sfPropelPlugin/test/unit', $root_dir . '/lib/plugins/sfPropelPlugin/test/functional', $root_dir . '/test/unit', $root_dir . '/test/functional', $root_dir . '/test/other'));
foreach ($files as $file) {
    $total_tests_loc += count(lime_coverage::get_php_lines($file));
}
printf("core librairies:           %6d\n", $total_loc);
printf("unit and functional tests: %6d\n", $total_tests_loc);
echo "---------------------------------\n";
printf("ratio tests/librairies:    %5d%%\n", $total_tests_loc / $total_loc * 100);
Example #4
0
<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <*****@*****.**>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once dirname(__FILE__) . '/../lib/lime/lime.php';
$h = new lime_harness(new lime_output(isset($argv) && in_array('--color', $argv)));
$h->base_dir = realpath(dirname(__FILE__) . '/..');
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(dirname(__FILE__) . '/..'), RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
    if (preg_match('/Test\\.php$/', $file)) {
        $h->register($file->getRealPath());
    }
}
$c = new lime_coverage($h);
$c->extension = '.php';
$c->verbose = true;
$c->base_dir = realpath(dirname(__FILE__) . '/../../lib');
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(dirname(__FILE__) . '/../../lib'), RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
    if (preg_match('/\\.php$/', $file)) {
        $c->register($file->getRealPath());
    }
}
$c->run();