Merge branch 'feature_code_coverage'
This commit is contained in:
14
Registry.php
14
Registry.php
@ -32,8 +32,18 @@ class Registry extends ArrayObject
|
|||||||
{
|
{
|
||||||
parent::__construct($array, $flags);
|
parent::__construct($array, $flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function __clone(){}
|
/**
|
||||||
|
* Refuse clone
|
||||||
|
* @codeCoverageIgnoreStart
|
||||||
|
*/
|
||||||
|
private function __clone()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @codeCoverageIgnoreStart
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the default registry instance.
|
* Retrieves the default registry instance.
|
||||||
|
@ -29,12 +29,17 @@ class CliController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Refuse cloning
|
* Refuse cloning
|
||||||
|
* @codeCoverageIgnoreStart
|
||||||
*/
|
*/
|
||||||
private function __clone()
|
private function __clone()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @codeCoverageIgnoreEnd
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
* @static
|
* @static
|
||||||
* @return CliController
|
* @return CliController
|
||||||
*/
|
*/
|
||||||
|
@ -35,12 +35,17 @@ class FrontController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Refuse cloning
|
* Refuse cloning
|
||||||
|
* @codeCoverageIgnoreStart
|
||||||
*/
|
*/
|
||||||
private function __clone()
|
private function __clone()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @codeCoverageIgnoreEnd
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
* @return FrontController
|
* @return FrontController
|
||||||
*/
|
*/
|
||||||
static public function getInstance()
|
static public function getInstance()
|
||||||
@ -128,7 +133,8 @@ class FrontController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $html;
|
return $html;
|
||||||
} catch (Exception $e) {
|
}
|
||||||
|
catch (Exception $e) {
|
||||||
if (Config::get('DEBUG')) {
|
if (Config::get('DEBUG')) {
|
||||||
if (!headers_sent()) {
|
if (!headers_sent()) {
|
||||||
if ($e instanceof ErrorHTTPException) {
|
if ($e instanceof ErrorHTTPException) {
|
||||||
|
@ -109,9 +109,6 @@ abstract class SqlDbDriver extends DbDriver
|
|||||||
public function quoteIdentifier($ident)
|
public function quoteIdentifier($ident)
|
||||||
{
|
{
|
||||||
$ident = explode('.', $ident);
|
$ident = explode('.', $ident);
|
||||||
if (!is_array($ident)) {
|
|
||||||
$ident = array($ident);
|
|
||||||
}
|
|
||||||
foreach ($ident as &$segment) {
|
foreach ($ident as &$segment) {
|
||||||
$segment = $this->identifier_quote . $segment . $this->identifier_quote;
|
$segment = $this->identifier_quote . $segment . $this->identifier_quote;
|
||||||
}
|
}
|
||||||
|
@ -21,14 +21,24 @@ class Session
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Avoid new
|
* Avoid new
|
||||||
|
* @codeCoverageIgnoreStart
|
||||||
*/
|
*/
|
||||||
private function __construct(){}
|
private function __construct(){}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @codeCoverageIgnoreEnd
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Avoid cloning
|
* Avoid cloning
|
||||||
|
* @codeCoverageIgnoreStart
|
||||||
*/
|
*/
|
||||||
private function __clone(){}
|
private function __clone(){}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @codeCoverageIgnoreEnd
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve a member of the $_SESSION
|
* Retrieve a member of the $_SESSION
|
||||||
*
|
*
|
||||||
|
@ -170,6 +170,23 @@ class LoadTest extends PHPUnit_Framework_TestCase
|
|||||||
Load::autoload('DbDriver');
|
Load::autoload('DbDriver');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @runInSeparateProcess
|
||||||
|
*/
|
||||||
|
public function testSetExclude()
|
||||||
|
{
|
||||||
|
$reflection_prop = new ReflectionProperty('Load', 'exclude');
|
||||||
|
$reflection_prop->setAccessible(true);
|
||||||
|
$this->assertCount(0, $reflection_prop->getValue('Load'));
|
||||||
|
Load::setExclude('dir1');
|
||||||
|
$this->assertCount(1, $reflection_prop->getValue('Load'));
|
||||||
|
Load::setExclude(array('dir2'));
|
||||||
|
$this->assertCount(2, $reflection_prop->getValue('Load'));
|
||||||
|
|
||||||
|
$this->assertSame(array('dir1', 'dir2'), $reflection_prop->getValue('Load'));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function newCallback($className)
|
protected function newCallback($className)
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,8 @@ require_once __DIR__ . '/../../app/CliController.php';
|
|||||||
require_once __DIR__ . '/../../Registry.php';
|
require_once __DIR__ . '/../../Registry.php';
|
||||||
require_once __DIR__ . '/../../Config.php';
|
require_once __DIR__ . '/../../Config.php';
|
||||||
require_once __DIR__ . '/../../app/iCli.php';
|
require_once __DIR__ . '/../../app/iCli.php';
|
||||||
|
require_once __DIR__ . '/../../logger/Logger.php';
|
||||||
|
require_once __DIR__ . '/../../logger/CliLogger.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @desc CliController tests
|
* @desc CliController tests
|
||||||
@ -55,6 +57,22 @@ class CliControllerTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertContains('Elapsed time:', $output);
|
$this->assertContains('Elapsed time:', $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testExecuteWithLogger()
|
||||||
|
{
|
||||||
|
ob_start();
|
||||||
|
Config::set('PROFILER', true);
|
||||||
|
Config::set('LOGGING', true);
|
||||||
|
Config::set('Logger', array('logger' => 'CliLogger'));
|
||||||
|
$cli_class = $this->getMockForAbstractClass('iCli', array(), '', '', '', '', array('run'));
|
||||||
|
$cli_class->expects($this->once())
|
||||||
|
->method('run')
|
||||||
|
->with();
|
||||||
|
CliController::getInstance()->execute($cli_class);
|
||||||
|
$output = ob_get_clean();
|
||||||
|
$this->assertContains('Elapsed time:', $output);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @runInSeparateProcess
|
* @runInSeparateProcess
|
||||||
*/
|
*/
|
||||||
|
@ -23,9 +23,14 @@ require_once dirname(__FILE__) . '/../../exception/GeneralException.php';
|
|||||||
class MySQLiStatementTest extends PHPUnit_Framework_TestCase
|
class MySQLiStatementTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var MySQLiDriver|PHPUnit_Framework_MockObject_MockObject
|
||||||
|
*/
|
||||||
private $driver;
|
private $driver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var MySQLiStatement
|
||||||
|
*/
|
||||||
private $stmt;
|
private $stmt;
|
||||||
|
|
||||||
private $sql;
|
private $sql;
|
||||||
|
@ -36,12 +36,17 @@ class Profiler
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Refuse cloning
|
* Refuse cloning
|
||||||
|
* @codeCoverageIgnoreStart
|
||||||
*/
|
*/
|
||||||
private function __clone()
|
private function __clone()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @codeCoverageIgnoreStart
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
* @return Profiler
|
* @return Profiler
|
||||||
*/
|
*/
|
||||||
static public function getInstance()
|
static public function getInstance()
|
||||||
|
Reference in New Issue
Block a user