Commit 4805dab4 authored by meus's avatar meus

refactored test harness and moved logic away from the run.php file. fixed...

refactored test harness and moved logic away from the run.php file. fixed coverage reporting so that it now generates a full html coverage files. look in tests/coverage/index.php in a browser for details
parent b202f467
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.com>.
*/
/**
* Doctrine_UnitTestCase
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Bjarte S. Karlsen <bjartka@pvv.ntnu.no>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
require_once dirname(__FILE__) . '/DoctrineTest/UnitTestCase.php';
require_once dirname(__FILE__) . '/DoctrineTest/GroupTest.php';
require_once dirname(__FILE__) . '/DoctrineTest/Doctrine_UnitTestCase.php';
require_once dirname(__FILE__) . '/DoctrineTest/Reporter.php';
class DoctrineTest
{
protected $testGroup; // the default test group
protected $groups;
public function __construct()
{
$this->requireModels();
$this->testGroup = new GroupTest('Doctrine Framework Unit Tests', 'main');
}
/**
* Add a test to be run.
*
* This is a thin wrapper around GroupTest that also store the testcase in
* this class so that it is easier to create custom groups
*
* @param UnitTestCase A test case
*/
public function addTestCase($testCase){
$this->groups[$testCase->getName()] = $testCase;
$this->testGroup->addTestCase($testCase);
}
/**
* Run the tests
*
* This method will run the tests with the correct Reporter. It will run
* grouped tests if asked to and filter results. It also has support for
* running coverage report.
*
*/
public function run(){
$testGroup = $this->testGroup;
if (PHP_SAPI === 'cli') {
require_once(dirname(__FILE__) . '/DoctrineTest/Reporter/Cli.php');
$reporter = new DoctrineTest_Reporter_Cli();
$argv = $_SERVER['argv'];
array_shift($argv);
$options = $this->parseOptions($argv);
} else {
require_once(dirname(__FILE__) . '/DoctrineTest/Reporter/Html.php');
$options = $_GET;
$reporter = new DoctrineTest_Reporter_Html();
}
//replace global group with custom group if we have group option set
if (isset($options['group'])) {
$testGroup = new GroupTest('Doctrine Framework Custom test', 'custom');
foreach($options['group'] as $group) {
if (isset($this->groups[$group])) {
$testGroup->addTestCase($this->groups[$group]);
} else if (class_exists($group)) {
$testGroup->addTestCase(new $group);
} else {
die($group . " is not a valid group or doctrine test class\n ");
}
}
}
$filter = '';
if (isset($options['filter'])) {
$filter = $options['filter'];
}
//show help text
if (isset($options['help'])) {
echo "Doctrine test runner help\n";
echo "===========================\n";
echo " To run all tests simply run this script without arguments. \n";
echo "\n Flags:\n";
echo " -coverage will generate coverage report data that can be viewed with the cc.php script in this folder. NB! This takes time. You need xdebug to run this\n";
echo " -group <groupName1> <groupName2> <className1> Use this option to run just a group of tests or tests with a given classname. Groups are currently defined as the variable name they are called in this script.\n";
echo " -filter <string1> <string2> case insensitive strings that will be applied to the className of the tests. A test_classname must contain all of these strings to be run\n";
echo "\nAvailable groups:\n tickets, transaction, driver, data_dict, sequence, export, import, expression, core, relation, data_types, utility, db, event_listener, query_tests, record, cache\n";
die();
}
//generate coverage report
if (isset($options['coverage'])) {
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
$testGroup->run($reporter, $filter);
$result['coverage'] = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
file_put_contents(dirname(__FILE__) . '/coverage/coverage.txt', serialize($result));
require_once dirname(__FILE__) . '/DoctrineTest/Coverage.php';
$coverageGeneration = new DoctrineTest_Coverage();
$coverageGeneration->generateReport();
} else {
$testGroup->run($reporter, $filter);
}
}
/**
* Require all the models needed in the tests
*
*/
public function requireModels()
{
$models = new DirectoryIterator(dirname(__FILE__) . '/../models/');
foreach($models as $key => $file) {
if ($file->isFile() && ! $file->isDot()) {
$e = explode('.', $file->getFileName());
if (end($e) === 'php') {
require_once $file->getPathname();
}
}
}
}
/**
* Parse Options from cli into an associative array
*
* @param array $array An argv array from cli
* @return array An array with options
*/
public function parseOptions($array) {
$currentName='';
$options=array();
foreach($array as $name) {
if (strpos($name,'-')===0) {
$name=str_replace('-','',$name);
$currentName=$name;
if ( ! isset($options[$currentName])) {
$options[$currentName]=array();
}
} else {
$values=$options[$currentName];
array_push($values,$name);
$options[$currentName]=$values;
}
}
return $options;
}
/**
* Autoload test cases
*
* Will create test case if it does not exist
*
* @param string $class The name of the class to autoload
* @return boolean True
*/
public static function autoload($class) {
if (strpos($class, 'TestCase') === false) {
return false;
}
$e = explode('_', $class);
$count = count($e);
$prefix = array_shift($e);
if ($prefix !== 'Doctrine') {
return false;
}
$dir = array_shift($e);
$file = $dir . '_' . substr(implode('_', $e), 0, -(strlen('_TestCase'))) . 'TestCase.php';
if ( $count > 3) {
$file = str_replace('_', DIRECTORY_SEPARATOR, $file);
} else {
$file = str_replace('_', '', $file);
}
// create a test case file if it doesn't exist
if ( ! file_exists($file)) {
$contents = file_get_contents('template.tpl');
$contents = sprintf($contents, $class, $class);
if ( ! file_exists($dir)) {
mkdir($dir, 0777);
}
file_put_contents($file, $contents);
}
require_once($file);
return true;
}
}
This diff is collapsed.
<?php
/**
* Doctrine
* the base class of Doctrine framework
*
* @package Doctrine
* @author Bjarte S. Karlsen <bjartka@pvv.ntnu.no>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision: 1976 $
*/
class Doctrine_TestCoverage
{
const COVERED = 1;
const MAYBE = -2;
const NOTCOVERED = -1;
private $path;
private $coverage;
private $key;
private $covered;
private $totallines = 0;
private $totalcovered = 0;
private $totalmaybe = 0;
private $totalnotcovered = 0;
/*
* Create a new coverage report
*
* @param string $file The name of the file where coverage data is stored
*
*/
public function __construct()
$result = unserialize(file_get_contents(__FILE__ . "/coverage.txt"));
$this->path = $result["path"];
$this->coverage = $result["coverage"];
$this->sortBy ="percentage"; // default sort
}
/*
* Show graphical coverage report for a file
*
* @param string $fileName The name of the file to show
*/
public function showFile($fileName)
{
$key = $this->path . $fileName;
$html = '<div id="coverage">';
if ( ! isset( $this->coverage[$key]))
{
echo '<h2>This file has not been tested!</h2>';
}
$coveredLines = $this->coverage[$key];
$fileArray = file(Doctrine::getPath() . "/".$fileName);
$html .= '<table>' . "\n";
foreach ($fileArray as $num => $line){
$linenum = $num+1;
$html .= '<tr><td>' . $linenum . '</td>' . "\n";
$class ="normal";
if (isset($coveredLines[$linenum]) && $coveredLines[$linenum] == 1){
$class = "covered";
} else if (isset($coveredLines[$linenum]) && $coveredLines[$linenum] == -1) {
$class ="red";
} else if (isset($coveredLines[$linenum]) && $coveredLines[$linenum] == -2) {
$class ="orange";
}
$line = str_replace(" ", "&nbsp;", htmlspecialchars($line));
$html .= '<td class="' . $class . '">' . $line . '</td></tr>' . "\n";
}
$html .='</table></div>';
echo $html;
}
/*
* Generate coverage data for non tested files
*
* Scans all files and records data for those that are not in the coverage
* record.
*
* @return array An array with coverage data
*/
public function generateNotCoveredFiles()
{
$it = new RecursiveDirectoryIterator(Doctrine::getPath());
$notCoveredArray = array();
foreach (new RecursiveIteratorIterator($it) as $file){
if (strpos($file->getPathname(), ".svn")){
continue;
}
$path = Doctrine::getPath() . DIRECTORY_SEPARATOR;
$coveredPath = str_replace($path, $this->path, $file->getPathname());
if (isset($this->coverage[$coveredPath])){
continue;
}
$class = str_replace($path, "", $file->getPathname());
$class = str_replace(DIRECTORY_SEPARATOR, "_", $class);
$class = substr($class, 0,-4);
if (strpos($class, '_Interface')) {
continue;
}
if ( ! class_exists($class)){
continue;
}
try{
$refClass = new ReflectionClass($class);
} catch (Exception $e){
echo $e->getMessage();
continue;
}
$lines = 0;
$methodLines = 0;
foreach ($refClass->getMethods() as $refMethod){
if ($refMethod->getDeclaringClass() != $refClass){
continue;
}
$methodLines = $refMethod->getEndLine() - $refMethod->getStartLine();
$lines += $methodLines;
}
if ($methodLines == 0){
$notCoveredArray[$class] = array("covered" => 0, "maybe" => 0, "notcovered"=>$lines, "total" => $lines, "percentage" => 100);
} else {
$notCoveredArray[$class] = array("covered" => 0, "maybe" => 0, "notcovered"=>$lines, "total" => $lines, "percentage" => 0);
}
$this->totallines += $lines;
$this->totalnotcovered += $lines;
}
return $notCoveredArray;
}
/*
* Show a summary of all files in Doctrine and their coverage data
*
* @uses generateNonCoveredFiles
* @uses generateCoverage
*/
public function showSummary()
{
if (isset($_GET["order"])){
$this->sortBy = $_GET["order"];
}
$coveredArray = $this->generateCoverage();
$notcoveredArray = $this->generateNotCoveredFiles();
$coveredArray = array_merge($coveredArray, $notcoveredArray);
//lets sort it.
uasort($coveredArray, array($this,"sortArray"));
//and flip if it perhaps?
if (isset($_GET["desc"]) && $_GET["desc"] == "true"){
$coveredArray = array_reverse($coveredArray, true);
}
//ugly code to print out the result:
echo "<tr><td>" . TOTAL . "</td><td>" . round((($this->totalcovered + $this->totalmaybe) / $this->totallines) * 100, 2) . " % </td><td>$this->totallines</td><td>$this->totalcovered</td><td>$this->totalmaybe</td><td>$this->totalnotcovered</td><td></td></tr>";
foreach($coveredArray as $class => $info){
$fileName = str_replace("_", "/", $class) . ".php";
echo "<tr><td>" . $class . "</td><td>" . $info["percentage"] . " % </td><td>" . $info["total"] . "</td><td>" . $info["covered"] . "</td><td>" . $info["maybe"] . "</td><td>" . $info["notcovered"]. "</td><td><a href=\"cc.php?file=" . $fileName . "\">coverage</a></td></tr>";
}
}
/*
* Generate coverage data for tested files
*
*@return array An array of coverage data
*/
public function generateCoverage()
{
$coveredArray = array();
foreach ($this->coverage as $file => $lines) {
$pos = strpos($file, $this->path);
if ($pos === false && $pos !== 0){
continue;
}
$class = str_replace(DIRECTORY_SEPARATOR, '_', substr($file, strlen($this->path), -4));
$class = str_replace($this->path, Doctrine::getPath(), $class);
if (strpos($class, '_Interface')) {
continue;
}
if ( ! class_exists($class)){
continue;
}
$total = count($lines) -1; //we have to remove one since it always reports the last line as a hit
$covered = 0;
$maybe = 0;
$notcovered = 0;
foreach ($lines as $result){
switch($result){
case self::COVERED:
$covered++;
break;
case self::NOTCOVERED:
$notcovered++;
break;
case self::MAYBE:
$maybe++;
break;
}
}
$covered--; //again we have to remove that last line.
$this->totallines += $total;
$this->totalcovered += $covered;
$this->totalnotcovered += $notcovered;
$this->totalmaybe += $maybe;
if ($total === 0) {
$total = 1;
}
$percentage = round((($covered + $maybe) / $total) * 100, 2);
$coveredArray[$class] = array("covered" => $covered, "maybe" => $maybe, "notcovered"=>$notcovered, "total" => $total, "percentage" => $percentage);
}
return $coveredArray;
}
/*
* Uasort function to sort the array by key
*
*/
public function sortArray($a, $b)
{
if ($a[$this->sortBy] == $b[$this->sortBy]) {
return 0;
}
return ( $a[$this->sortBy] < $b[$this->sortBy]) ? -1 : 1;
}
}
......@@ -52,13 +52,18 @@ class Doctrine_UnitTestCase extends UnitTestCase
protected $expr;
protected $dataDict;
protected $transaction;
protected $_name;
protected $init = false;
public function getName(){
return $this->_name;
}
public function init()
{
$name = get_class($this);
$this->_name = get_class($this);
$this->manager = Doctrine_Manager::getInstance();
$this->manager->setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_ALL);
......
<?php
class GroupTest extends UnitTestCase
{
protected $_testCases = array();
protected $_name;
protected $_title;
public function __construct($title, $name)
{
$this->_title = $title;
$this->_name = $name;
}
public function getName(){
return $this->_name;
}
public function addTestCase(UnitTestCase $testCase)
{
if($testCase instanceOf GroupTest) {
$this->_testCases = array_merge($this->_testCases, $testCase->getTestCases());
} else {
$this->_testCases[get_class($testCase)] = $testCase;
}
}
public function shouldBeRun($testCase, $filter){
if ( ! is_array($filter)) {
return true;
}
foreach($filter as $subFilter) {
$name = strtolower(get_class($testCase));
$pos = strpos($name, strtolower($subFilter));
//it can be 0 so we have to use === to see if false
if ($pos === false) {
return false;
}
}
return true;
}
public function run(DoctrineTest_Reporter $reporter = null, $filter = null)
{
$reporter->paintHeader($this->_title);
foreach ($this->_testCases as $k => $testCase) {
if ( ! $this->shouldBeRun($testCase, $filter)) {
continue;
}
try{
$testCase->run();
} catch(Exception $e) {
$this->_failed += 1;
$this->_messages[] = 'Unexpected exception thrown with message [' . $e->getMessage() . '] in ' . $e->getFile() . ' on line ' . $e->getLine();
}
$this->_passed += $testCase->getPassCount();
$this->_failed += $testCase->getFailCount();
$this->_messages = array_merge($this->_messages, $testCase->getMessages());
$this->_testCases[$k] = null;
if(PHP_SAPI === 'cli'){
echo '.';
}
set_time_limit(900);
}
$reporter->setTestCase($this);
$reporter->paintFooter();
}
public function getTestCaseCount()
{
return count($this->_testCases);
}
public function getTestCases(){
return $this->_testCases;
}
}
<?php
class DoctrineTest_Reporter
{
protected $_test;
public function setTestCase(GroupTest $test)
{
$this->_test = $test;
}
}
<?php
class DoctrineTest_Reporter_Cli extends DoctrineTest_Reporter{
public function paintHeader($name){
echo $name . "\n";
echo "====================\n";
}
public function paintFooter(){
echo "\n";
foreach ($this->_test->getMessages() as $message) {
print $message . "\n";
}
echo "====================\n";
print "Tested: " . $this->_test->getTestCaseCount() . ' test cases' ."\n";
print "Successes: " . $this->_test->getPassCount() . " passes. \n";
print "Failures: " . $this->_test->getFailCount() . " fails. \n";
}
}
<?php
class DoctrineHtmlReporter extends HtmlReporter {
public function paintHeader($name) {
?>
<html>
<head>
<title>Doctrine Unit Tests</title>
<style>
.fail { color: red; } pre { background-color: lightgray; }
</style>
</head>
<body>
<h1><?php echo $name ?></h1>
<?php
}
public function paintFooter()
{
print '<pre>';
foreach ($this->_test->getMessages() as $message) {
print "<p>$message</p>";
}
print '</pre>';
$colour = ($this->_test->getFailCount() > 0 ? 'red' : 'green');
print '<div style=\'';
print "padding: 8px; margin-top: 1em; background-color: $colour; color: white;";
print '\'>';
print $this->_test->getTestCaseCount() . ' test cases.';
print '<strong>' . $this->_test->getPassCount() . '</strong> passes and ';
print '<strong>' . $this->_test->getFailCount() . '</strong> fails.';
print '</div>';
}
}
<?php
class GroupTest extends UnitTestCase
{
protected $_testCases = array();
public function __construct()
{
if (extension_loaded('xdebug')) {
//xdebug_start_code_coverage(XDEBUG_CC_DEAD_CODE | XDEBUG_CC_UNUSED);
}
}
public function addTestCase(UnitTestCase $testCase)
{
if($testCase instanceOf GroupTest) {
$this->_testCases = array_merge($this->_testCases, $testCase->getTestCases());
} else {
$this->_testCases[get_class($testCase)] = $testCase;
}
}
public function shouldBeRun($testCase, $filter){
if ( ! is_array($filter)) {
return true;
}
foreach($filter as $subFilter) {
$name = strtolower(get_class($testCase));
$pos = strpos($name, strtolower($subFilter));
//it can be 0 so we have to use === to see if false
if ($pos === false) {
return false;
}
}
return true;
}
public function run(HtmlReporter $reporter = null, $filter = null)
{
$reporter->paintHeader();
foreach ($this->_testCases as $k => $testCase) {
if ( ! $this->shouldBeRun($testCase, $filter)) {
continue;
}
try{
$testCase->run();
} catch(Exception $e) {
$this->_failed += 1;
$this->_messages[] = 'Unexpected exception thrown with message [' . $e->getMessage() . '] in ' . $e->getFile() . ' on line ' . $e->getLine();
}
$this->_passed += $testCase->getPassCount();
$this->_failed += $testCase->getFailCount();
$this->_messages = array_merge($this->_messages, $testCase->getMessages());
$this->_testCases[$k] = null;
if(PHP_SAPI === 'cli'){
echo '.';
}
set_time_limit(900);
}
$reporter->setTestCase($this);
$reporter->paintFooter();
}
public function getTestCaseCount()
{
return count($this->_testCases);
}
public function getTestCases(){
return $this->_testCases;
}
}
class HtmlReporter
{
protected $_test;
public function setTestCase(GroupTest $test)
{
$this->_test = $test;
}
}
class UnitTestCase
{
protected $_passed = 0;
......@@ -165,7 +84,7 @@ class UnitTestCase
}
$this->_failed++;
}
public function run(HtmlReporter $reporter = null, $filter = null)
public function run(DoctrineTest_Reporter $reporter = null, $filter = null)
{
foreach (get_class_methods($this) as $method) {
if (substr($method, 0, 4) === 'test') {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<html>
<head>
<title>Coverage for Doctrine_Connection_Common</title>
<style type="text/css">
.covered{ background: green;}
.normal{ background: white;}
.red{ background: red;}
.orange{ background: #f90;}
</style>
</head>
<body><h1>Coverage for Doctrine_Connection_Common</h1><p><a href="index.php">Back to coverage report</a></p><table>
<tr><td>1</td>
<td class="normal">&lt;?php
</td></tr>
<tr><td>2</td>
<td class="normal">/*
</td></tr>
<tr><td>3</td>
<td class="normal">&nbsp;*&nbsp;&nbsp;$Id:&nbsp;Common.php&nbsp;2702&nbsp;2007-10-03&nbsp;21:43:22Z&nbsp;Jonathan.Wage&nbsp;$
</td></tr>
<tr><td>4</td>
<td class="normal">&nbsp;*
</td></tr>
<tr><td>5</td>
<td class="normal">&nbsp;*&nbsp;THIS&nbsp;SOFTWARE&nbsp;IS&nbsp;PROVIDED&nbsp;BY&nbsp;THE&nbsp;COPYRIGHT&nbsp;HOLDERS&nbsp;AND&nbsp;CONTRIBUTORS
</td></tr>
<tr><td>6</td>
<td class="normal">&nbsp;*&nbsp;&quot;AS&nbsp;IS&quot;&nbsp;AND&nbsp;ANY&nbsp;EXPRESS&nbsp;OR&nbsp;IMPLIED&nbsp;WARRANTIES,&nbsp;INCLUDING,&nbsp;BUT&nbsp;NOT
</td></tr>
<tr><td>7</td>
<td class="normal">&nbsp;*&nbsp;LIMITED&nbsp;TO,&nbsp;THE&nbsp;IMPLIED&nbsp;WARRANTIES&nbsp;OF&nbsp;MERCHANTABILITY&nbsp;AND&nbsp;FITNESS&nbsp;FOR
</td></tr>
<tr><td>8</td>
<td class="normal">&nbsp;*&nbsp;A&nbsp;PARTICULAR&nbsp;PURPOSE&nbsp;ARE&nbsp;DISCLAIMED.&nbsp;IN&nbsp;NO&nbsp;EVENT&nbsp;SHALL&nbsp;THE&nbsp;COPYRIGHT
</td></tr>
<tr><td>9</td>
<td class="normal">&nbsp;*&nbsp;OWNER&nbsp;OR&nbsp;CONTRIBUTORS&nbsp;BE&nbsp;LIABLE&nbsp;FOR&nbsp;ANY&nbsp;DIRECT,&nbsp;INDIRECT,&nbsp;INCIDENTAL,
</td></tr>
<tr><td>10</td>
<td class="normal">&nbsp;*&nbsp;SPECIAL,&nbsp;EXEMPLARY,&nbsp;OR&nbsp;CONSEQUENTIAL&nbsp;DAMAGES&nbsp;(INCLUDING,&nbsp;BUT&nbsp;NOT
</td></tr>
<tr><td>11</td>
<td class="normal">&nbsp;*&nbsp;LIMITED&nbsp;TO,&nbsp;PROCUREMENT&nbsp;OF&nbsp;SUBSTITUTE&nbsp;GOODS&nbsp;OR&nbsp;SERVICES;&nbsp;LOSS&nbsp;OF&nbsp;USE,
</td></tr>
<tr><td>12</td>
<td class="normal">&nbsp;*&nbsp;DATA,&nbsp;OR&nbsp;PROFITS;&nbsp;OR&nbsp;BUSINESS&nbsp;INTERRUPTION)&nbsp;HOWEVER&nbsp;CAUSED&nbsp;AND&nbsp;ON&nbsp;ANY
</td></tr>
<tr><td>13</td>
<td class="normal">&nbsp;*&nbsp;THEORY&nbsp;OF&nbsp;LIABILITY,&nbsp;WHETHER&nbsp;IN&nbsp;CONTRACT,&nbsp;STRICT&nbsp;LIABILITY,&nbsp;OR&nbsp;TORT
</td></tr>
<tr><td>14</td>
<td class="normal">&nbsp;*&nbsp;(INCLUDING&nbsp;NEGLIGENCE&nbsp;OR&nbsp;OTHERWISE)&nbsp;ARISING&nbsp;IN&nbsp;ANY&nbsp;WAY&nbsp;OUT&nbsp;OF&nbsp;THE&nbsp;USE
</td></tr>
<tr><td>15</td>
<td class="normal">&nbsp;*&nbsp;OF&nbsp;THIS&nbsp;SOFTWARE,&nbsp;EVEN&nbsp;IF&nbsp;ADVISED&nbsp;OF&nbsp;THE&nbsp;POSSIBILITY&nbsp;OF&nbsp;SUCH&nbsp;DAMAGE.
</td></tr>
<tr><td>16</td>
<td class="normal">&nbsp;*
</td></tr>
<tr><td>17</td>
<td class="normal">&nbsp;*&nbsp;This&nbsp;software&nbsp;consists&nbsp;of&nbsp;voluntary&nbsp;contributions&nbsp;made&nbsp;by&nbsp;many&nbsp;individuals
</td></tr>
<tr><td>18</td>
<td class="normal">&nbsp;*&nbsp;and&nbsp;is&nbsp;licensed&nbsp;under&nbsp;the&nbsp;LGPL.&nbsp;For&nbsp;more&nbsp;information,&nbsp;see
</td></tr>
<tr><td>19</td>
<td class="normal">&nbsp;*&nbsp;&lt;http://www.phpdoctrine.com&gt;.
</td></tr>
<tr><td>20</td>
<td class="normal">&nbsp;*/
</td></tr>
<tr><td>21</td>
<td class="covered">Doctrine::autoload('Doctrine_Connection');
</td></tr>
<tr><td>22</td>
<td class="normal">/**
</td></tr>
<tr><td>23</td>
<td class="normal">&nbsp;*&nbsp;standard&nbsp;connection,&nbsp;the&nbsp;parent&nbsp;of&nbsp;pgsql,&nbsp;mysql&nbsp;and&nbsp;sqlite
</td></tr>
<tr><td>24</td>
<td class="normal">&nbsp;*
</td></tr>
<tr><td>25</td>
<td class="normal">&nbsp;*&nbsp;@package&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Doctrine
</td></tr>
<tr><td>26</td>
<td class="normal">&nbsp;*&nbsp;@subpackage&nbsp;&nbsp;Connection
</td></tr>
<tr><td>27</td>
<td class="normal">&nbsp;*&nbsp;@link&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;www.phpdoctrine.com
</td></tr>
<tr><td>28</td>
<td class="normal">&nbsp;*&nbsp;@license&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;http://www.opensource.org/licenses/lgpl-license.php&nbsp;LGPL
</td></tr>
<tr><td>29</td>
<td class="normal">&nbsp;*&nbsp;@since&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.0
</td></tr>
<tr><td>30</td>
<td class="normal">&nbsp;*&nbsp;@version&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$Revision:&nbsp;2702&nbsp;$
</td></tr>
<tr><td>31</td>
<td class="normal">&nbsp;*&nbsp;@author&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Konsta&nbsp;Vesterinen&nbsp;&lt;kvesteri@cc.hut.fi&gt;
</td></tr>
<tr><td>32</td>
<td class="normal">&nbsp;*/
</td></tr>
<tr><td>33</td>
<td class="covered">class&nbsp;Doctrine_Connection_Common&nbsp;extends&nbsp;Doctrine_Connection
</td></tr>
<tr><td>34</td>
<td class="normal">{
</td></tr>
<tr><td>35</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;/**
</td></tr>
<tr><td>36</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Adds&nbsp;an&nbsp;driver-specific&nbsp;LIMIT&nbsp;clause&nbsp;to&nbsp;the&nbsp;query
</td></tr>
<tr><td>37</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*
</td></tr>
<tr><td>38</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$query
</td></tr>
<tr><td>39</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;mixed&nbsp;$limit
</td></tr>
<tr><td>40</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;mixed&nbsp;$offset
</td></tr>
<tr><td>41</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
</td></tr>
<tr><td>42</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;modifyLimitQuery($query,&nbsp;$limit&nbsp;=&nbsp;false,$offset&nbsp;=&nbsp;false,$isManip=false)
</td></tr>
<tr><td>43</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;{
</td></tr>
<tr><td>44</td>
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$limit&nbsp;=&nbsp;(int)&nbsp;$limit;
</td></tr>
<tr><td>45</td>
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$offset&nbsp;=&nbsp;(int)&nbsp;$offset;
</td></tr>
<tr><td>46</td>
<td class="normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td></tr>
<tr><td>47</td>
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($limit&nbsp;&amp;&amp;&nbsp;$offset)&nbsp;{
</td></tr>
<tr><td>48</td>
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$query&nbsp;.=&nbsp;'&nbsp;LIMIT&nbsp;'&nbsp;.&nbsp;$limit&nbsp;.&nbsp;'&nbsp;OFFSET&nbsp;'&nbsp;.&nbsp;$offset;
</td></tr>
<tr><td>49</td>
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;elseif&nbsp;($limit&nbsp;&amp;&amp;&nbsp;!&nbsp;$offset)&nbsp;{
</td></tr>
<tr><td>50</td>
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$query&nbsp;.=&nbsp;'&nbsp;LIMIT&nbsp;'&nbsp;.&nbsp;$limit;
</td></tr>
<tr><td>51</td>
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;elseif&nbsp;(&nbsp;!&nbsp;$limit&nbsp;&amp;&amp;&nbsp;$offset)&nbsp;{
</td></tr>
<tr><td>52</td>
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$query&nbsp;.=&nbsp;'&nbsp;LIMIT&nbsp;999999999999&nbsp;OFFSET&nbsp;'&nbsp;.&nbsp;$offset;
</td></tr>
<tr><td>53</td>
<td class="red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>54</td>
<td class="normal">
</td></tr>
<tr><td>55</td>
<td class="covered">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$query;
</td></tr>
<tr><td>56</td>
<td class="orange">&nbsp;&nbsp;&nbsp;&nbsp;}
</td></tr>
<tr><td>57</td>
<td class="covered">}</td></tr>
</table></body></html>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<html>
<head>
<title>Coverage for Doctrine_DataDict_Exception</title>
<style type="text/css">
.covered{ background: green;}
.normal{ background: white;}
.red{ background: red;}
.orange{ background: #f90;}
</style>
</head>
<body><h1>Coverage for Doctrine_DataDict_Exception</h1><p><a href="index.php">Back to coverage report</a></p><table>
<tr><td>1</td>
<td class="normal">&lt;?php
</td></tr>
<tr><td>2</td>
<td class="normal">/*
</td></tr>
<tr><td>3</td>
<td class="normal">&nbsp;*&nbsp;&nbsp;$Id:&nbsp;Exception.php&nbsp;2702&nbsp;2007-10-03&nbsp;21:43:22Z&nbsp;Jonathan.Wage&nbsp;$
</td></tr>
<tr><td>4</td>
<td class="normal">&nbsp;*
</td></tr>
<tr><td>5</td>
<td class="normal">&nbsp;*&nbsp;THIS&nbsp;SOFTWARE&nbsp;IS&nbsp;PROVIDED&nbsp;BY&nbsp;THE&nbsp;COPYRIGHT&nbsp;HOLDERS&nbsp;AND&nbsp;CONTRIBUTORS
</td></tr>
<tr><td>6</td>
<td class="normal">&nbsp;*&nbsp;&quot;AS&nbsp;IS&quot;&nbsp;AND&nbsp;ANY&nbsp;EXPRESS&nbsp;OR&nbsp;IMPLIED&nbsp;WARRANTIES,&nbsp;INCLUDING,&nbsp;BUT&nbsp;NOT
</td></tr>
<tr><td>7</td>
<td class="normal">&nbsp;*&nbsp;LIMITED&nbsp;TO,&nbsp;THE&nbsp;IMPLIED&nbsp;WARRANTIES&nbsp;OF&nbsp;MERCHANTABILITY&nbsp;AND&nbsp;FITNESS&nbsp;FOR
</td></tr>
<tr><td>8</td>
<td class="normal">&nbsp;*&nbsp;A&nbsp;PARTICULAR&nbsp;PURPOSE&nbsp;ARE&nbsp;DISCLAIMED.&nbsp;IN&nbsp;NO&nbsp;EVENT&nbsp;SHALL&nbsp;THE&nbsp;COPYRIGHT
</td></tr>
<tr><td>9</td>
<td class="normal">&nbsp;*&nbsp;OWNER&nbsp;OR&nbsp;CONTRIBUTORS&nbsp;BE&nbsp;LIABLE&nbsp;FOR&nbsp;ANY&nbsp;DIRECT,&nbsp;INDIRECT,&nbsp;INCIDENTAL,
</td></tr>
<tr><td>10</td>
<td class="normal">&nbsp;*&nbsp;SPECIAL,&nbsp;EXEMPLARY,&nbsp;OR&nbsp;CONSEQUENTIAL&nbsp;DAMAGES&nbsp;(INCLUDING,&nbsp;BUT&nbsp;NOT
</td></tr>
<tr><td>11</td>
<td class="normal">&nbsp;*&nbsp;LIMITED&nbsp;TO,&nbsp;PROCUREMENT&nbsp;OF&nbsp;SUBSTITUTE&nbsp;GOODS&nbsp;OR&nbsp;SERVICES;&nbsp;LOSS&nbsp;OF&nbsp;USE,
</td></tr>
<tr><td>12</td>
<td class="normal">&nbsp;*&nbsp;DATA,&nbsp;OR&nbsp;PROFITS;&nbsp;OR&nbsp;BUSINESS&nbsp;INTERRUPTION)&nbsp;HOWEVER&nbsp;CAUSED&nbsp;AND&nbsp;ON&nbsp;ANY
</td></tr>
<tr><td>13</td>
<td class="normal">&nbsp;*&nbsp;THEORY&nbsp;OF&nbsp;LIABILITY,&nbsp;WHETHER&nbsp;IN&nbsp;CONTRACT,&nbsp;STRICT&nbsp;LIABILITY,&nbsp;OR&nbsp;TORT
</td></tr>
<tr><td>14</td>
<td class="normal">&nbsp;*&nbsp;(INCLUDING&nbsp;NEGLIGENCE&nbsp;OR&nbsp;OTHERWISE)&nbsp;ARISING&nbsp;IN&nbsp;ANY&nbsp;WAY&nbsp;OUT&nbsp;OF&nbsp;THE&nbsp;USE
</td></tr>
<tr><td>15</td>
<td class="normal">&nbsp;*&nbsp;OF&nbsp;THIS&nbsp;SOFTWARE,&nbsp;EVEN&nbsp;IF&nbsp;ADVISED&nbsp;OF&nbsp;THE&nbsp;POSSIBILITY&nbsp;OF&nbsp;SUCH&nbsp;DAMAGE.
</td></tr>
<tr><td>16</td>
<td class="normal">&nbsp;*
</td></tr>
<tr><td>17</td>
<td class="normal">&nbsp;*&nbsp;This&nbsp;software&nbsp;consists&nbsp;of&nbsp;voluntary&nbsp;contributions&nbsp;made&nbsp;by&nbsp;many&nbsp;individuals
</td></tr>
<tr><td>18</td>
<td class="normal">&nbsp;*&nbsp;and&nbsp;is&nbsp;licensed&nbsp;under&nbsp;the&nbsp;LGPL.&nbsp;For&nbsp;more&nbsp;information,&nbsp;see
</td></tr>
<tr><td>19</td>
<td class="normal">&nbsp;*&nbsp;&lt;http://www.phpdoctrine.com&gt;.
</td></tr>
<tr><td>20</td>
<td class="normal">&nbsp;*/
</td></tr>
<tr><td>21</td>
<td class="covered">Doctrine::autoload('Doctrine_Exception');
</td></tr>
<tr><td>22</td>
<td class="normal">/**
</td></tr>
<tr><td>23</td>
<td class="normal">&nbsp;*&nbsp;Doctrine_DataDict_Exception
</td></tr>
<tr><td>24</td>
<td class="normal">&nbsp;*
</td></tr>
<tr><td>25</td>
<td class="normal">&nbsp;*&nbsp;@package&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Doctrine
</td></tr>
<tr><td>26</td>
<td class="normal">&nbsp;*&nbsp;@subpackage&nbsp;&nbsp;DataDict
</td></tr>
<tr><td>27</td>
<td class="normal">&nbsp;*&nbsp;@license&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;http://www.opensource.org/licenses/lgpl-license.php&nbsp;LGPL
</td></tr>
<tr><td>28</td>
<td class="normal">&nbsp;*&nbsp;@link&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;www.phpdoctrine.com
</td></tr>
<tr><td>29</td>
<td class="normal">&nbsp;*&nbsp;@since&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.0
</td></tr>
<tr><td>30</td>
<td class="normal">&nbsp;*&nbsp;@version&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$Revision:&nbsp;2702&nbsp;$
</td></tr>
<tr><td>31</td>
<td class="normal">&nbsp;*&nbsp;@author&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Konsta&nbsp;Vesterinen&nbsp;&lt;kvesteri@cc.hut.fi&gt;
</td></tr>
<tr><td>32</td>
<td class="normal">&nbsp;*/
</td></tr>
<tr><td>33</td>
<td class="covered">class&nbsp;Doctrine_DataDict_Exception&nbsp;extends&nbsp;Doctrine_Exception
</td></tr>
<tr><td>34</td>
<td class="covered">{&nbsp;}</td></tr>
</table></body></html>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment