run.php 6.91 KB
Newer Older
1 2 3 4
<?php
ob_start();


5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
require_once('ConfigurableTestCase.php');
require_once('ManagerTestCase.php');
require_once('ConnectionTestCase.php');
require_once('ConnectionTransactionTestCase.php');
require_once('TableTestCase.php');
require_once('EventListenerTestCase.php');
require_once('BatchIteratorTestCase.php');
require_once('CacheFileTestCase.php');

require_once('RecordTestCase.php');
require_once('RecordStateTestCase.php');
require_once('RecordFilterTestCase.php');

require_once('AccessTestCase.php');
require_once('ValidatorTestCase.php');
require_once('CollectionTestCase.php');
require_once('PessimisticLockingTestCase.php');
require_once('EventListenerChainTestCase.php');
require_once('CacheSqliteTestCase.php');
require_once('CollectionOffsetTestCase.php');

require_once('CacheQuerySqliteTestCase.php');
require_once('ViewTestCase.php');
require_once('RawSqlTestCase.php');
require_once('CustomPrimaryKeyTestCase.php');
require_once('FilterTestCase.php');

require_once('QueryTestCase.php');
require_once('QueryLimitTestCase.php');
require_once('QueryMultiJoinTestCase.php');
require_once('QueryReferenceModelTestCase.php');
require_once('QueryWhereTestCase.php');
require_once('QueryFromTestCase.php');
require_once('QueryConditionTestCase.php');
require_once('QueryComponentAliasTestCase.php');
require_once('QuerySubqueryTestCase.php');
require_once('QuerySelectTestCase.php');
require_once('QueryDeleteTestCase.php');
require_once('QueryUpdateTestCase.php');

require_once('RelationAccessTestCase.php');
require_once('RelationTestCase.php');
require_once('RelationManyToManyTestCase.php');


require_once('DBTestCase.php');
require_once('SchemaTestCase.php');
require_once('ImportTestCase.php');
require_once('BooleanTestCase.php');
require_once('EnumTestCase.php');

require_once('DataDictSqliteTestCase.php');
57 58 59
require_once('DataDict/PgsqlTestCase.php');


60
require_once('CustomResultSetOrderTestCase.php');
61 62

error_reporting(E_ALL);
63
print '<pre>';
64

65
$test = new GroupTest('Doctrine Framework Unit Tests');
zYne's avatar
zYne committed
66

67
$test->addTestCase(new Doctrine_Record_TestCase());
68

69
$test->addTestCase(new Doctrine_DataDict_Pgsql_TestCase());
70

71 72
$test->addTestCase(new Doctrine_Relation_ManyToMany_TestCase());

73 74
$test->addTestCase(new Doctrine_Relation_TestCase());

75
$test->addTestCase(new Doctrine_Record_State_TestCase());
zYne's avatar
zYne committed
76

77 78 79
$test->addTestCase(new Doctrine_Import_TestCase());

$test->addTestCase(new Doctrine_SchemaTestCase());
80

81 82
$test->addTestCase(new Doctrine_ValidatorTestCase());

83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
$test->addTestCase(new Doctrine_Query_MultiJoin_TestCase());

$test->addTestCase(new Doctrine_EventListenerTestCase());

$test->addTestCase(new Doctrine_Connection_Transaction_TestCase());

$test->addTestCase(new Doctrine_ConnectionTestCase());

$test->addTestCase(new Doctrine_DB_TestCase());

$test->addTestCase(new Doctrine_AccessTestCase());

$test->addTestCase(new Doctrine_TableTestCase());

$test->addTestCase(new Doctrine_ManagerTestCase());

$test->addTestCase(new Doctrine_BatchIteratorTestCase());

$test->addTestCase(new Doctrine_ConfigurableTestCase());

zYne's avatar
zYne committed
103
//$test->addTestCase(new Doctrine_Collection_Offset_TestCase());
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124

$test->addTestCase(new Doctrine_PessimisticLockingTestCase());

$test->addTestCase(new Doctrine_ViewTestCase());

$test->addTestCase(new Doctrine_Cache_Query_SqliteTestCase());

$test->addTestCase(new Doctrine_CustomPrimaryKeyTestCase());

$test->addTestCase(new Doctrine_Filter_TestCase());

$test->addTestCase(new Doctrine_RawSql_TestCase());

$test->addTestCase(new Doctrine_CollectionTestCase());

$test->addTestCase(new Doctrine_Query_ReferenceModel_TestCase());

$test->addTestCase(new Doctrine_DataDict_Sqlite_TestCase());

$test->addTestCase(new Doctrine_EventListener_Chain_TestCase());

125 126
$test->addTestCase(new Doctrine_RelationAccessTestCase());

127 128
$test->addTestCase(new Doctrine_CustomResultSetOrderTestCase());

129 130
$test->addTestCase(new Doctrine_BooleanTestCase());

131 132 133 134
$test->addTestCase(new Doctrine_Record_Filter_TestCase());

$test->addTestCase(new Doctrine_Query_Condition_TestCase());

135 136
$test->addTestCase(new Doctrine_Query_ComponentAlias_TestCase());

137 138
$test->addTestCase(new Doctrine_Query_Subquery_TestCase());

zYne's avatar
zYne committed
139
$test->addTestCase(new Doctrine_Query_TestCase());
140 141 142

$test->addTestCase(new Doctrine_Query_Where_TestCase());

143 144
$test->addTestCase(new Doctrine_Query_From_TestCase());

zYne's avatar
zYne committed
145
$test->addTestCase(new Doctrine_Query_Select_TestCase());
146

zYne's avatar
zYne committed
147 148
$test->addTestCase(new Doctrine_Query_Delete_TestCase());

zYne's avatar
zYne committed
149
$test->addTestCase(new Doctrine_Query_Update_TestCase());
zYne's avatar
zYne committed
150

151
$test->addTestCase(new Doctrine_Query_Limit_TestCase());
152

153 154
$test->addTestCase(new Doctrine_EnumTestCase());

155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
//$test->addTestCase(new Doctrine_Cache_FileTestCase());
//$test->addTestCase(new Doctrine_Cache_SqliteTestCase());

class MyReporter extends HtmlReporter {
    public function paintHeader() {}
    public function paintFooter()
    {
        $colour = ($this->getFailCount() + $this->getExceptionCount() > 0 ? "red" : "green");
        print "<div style=\"";
        print "padding: 8px; margin-top: 1em; background-color: $colour; color: white;";
        print "\">";
        print $this->getTestCaseProgress() . "/" . $this->getTestCaseCount();
        print " test cases complete:\n";
        print "<strong>" . $this->getPassCount() . "</strong> passes, ";
        print "<strong>" . $this->getFailCount() . "</strong> fails and ";
        print "<strong>" . $this->getExceptionCount() . "</strong> exceptions.";
        print "</div>\n";
    }
}

if (TextReporter::inCli()) {
    if ($argc == 4)
    {
        $dsn = $argv[1];
        $username = $argv[2];
        $password = $argv[3];
    }
    exit ($test->run(new TextReporter()) ? 0 : 1);
} else {
    if (isset($_POST))
    {
186 187 188
        $dsn        = isset($_POST["dsn"])?$_POST["dsn"]:null;
        $username   = isset($_POST["username"])?$_POST["username"]:null;
        $password   = isset($_POST["password"])?$_POST["password"]:null;
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
    }
    $test->run(new MyReporter());
    $output = ob_get_clean();
}
/**
$cache = Doctrine_Manager::getInstance()->getCurrentConnection()->getCacheHandler();
if(isset($cache)) {
    $a     = $cache->getQueries();
    print "Executed cache queries: ".count($a)."\n";

    foreach($a as $query) {
        print $query."\n";
    }

}
*/
?>
<html>
<head>

  <title>Doctrine Unit Tests</title>
  <style>
.fail { color: red; } pre { background-color: lightgray; }
  </style>
</head>

<body>

<h1>Doctrine Unit Tests</h1>
<h3>DSN Settings</h3>
<form method="post">
<table>
<tr>
  <th>DSN</th>
  <td><input type="text" name="dsn" /></td>
</tr>
<tr>
  <th>Username</th>
  <td><input type="text" name="username" /></td>
</tr>
<tr>
  <th>Password</th>
  <td><input type="text" name="password" /></td>
</tr>
<tr>
  <td>&nbsp;</td>
  <td><input type="submit" name="submit" /></td>
</tr>
</table>
</form>
<h3>Tests</h3>
<pre>
<?php echo $output; ?>
</pre>
<h3>Queries</h3>
<pre>
<?php
$dbh = Doctrine_Manager::getInstance()->getCurrentConnection()->getDBH();
$a   = $dbh->getQueries();

print "Executed queries: ".count($a)."\n";

foreach($a as $query) {
    print $query."\n";
}
?>
</pre>
</body>
</html>