Commit d1ad19fd authored by zYne's avatar zYne

Modified the test structure

parent a622f9ab
<?php
class Doctrine_AccessTestCase extends Doctrine_UnitTestCase {
/*
* $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_Access_TestCase
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class Doctrine_Access_TestCase extends Doctrine_UnitTestCase {
public function prepareData() { }
public function prepareTables() {
$this->tables = array("Entity", "User");
$this->tables = array('Entity', 'User');
parent::prepareTables();
}
public function testUnset() {
public function testUnset() {
}
public function testIsset() {
......@@ -32,54 +61,54 @@ class Doctrine_AccessTestCase extends Doctrine_UnitTestCase {
}
public function testOffsetMethods() {
$user = new User();
$this->assertEqual($user["name"],null);
$this->assertEqual($user['name'],null);
$user["name"] = "Jack";
$this->assertEqual($user["name"],"Jack");
$user['name'] = 'Jack';
$this->assertEqual($user['name'], 'Jack');
$user->save();
$user = $this->connection->getTable("User")->find($user->obtainIdentifier());
$this->assertEqual($user->name,"Jack");
$user = $this->connection->getTable('User')->find($user->obtainIdentifier());
$this->assertEqual($user->name, 'Jack');
$user["name"] = "Jack";
$this->assertEqual($user["name"],"Jack");
$user["name"] = "zYne";
$this->assertEqual($user["name"],"zYne");
$user['name'] = 'Jack';
$this->assertEqual($user['name'], 'Jack');
$user['name'] = 'zYne';
$this->assertEqual($user['name'], 'zYne');
}
public function testOverload() {
$user = new User();
$this->assertEqual($user->name,null);
$user->name = "Jack";
$user->name = 'Jack';
$this->assertEqual($user->name,"Jack");
$this->assertEqual($user->name, 'Jack');
$user->save();
$user = $this->connection->getTable("User")->find($user->obtainIdentifier());
$this->assertEqual($user->name,"Jack");
$user = $this->connection->getTable('User')->find($user->obtainIdentifier());
$this->assertEqual($user->name, 'Jack');
$user->name = "Jack";
$this->assertEqual($user->name,"Jack");
$user->name = "zYne";
$this->assertEqual($user->name,"zYne");
$user->name = 'Jack';
$this->assertEqual($user->name, 'Jack');
$user->name = 'zYne';
$this->assertEqual($user->name, 'zYne');
}
public function testSet() {
$user = new User();
$this->assertEqual($user->get("name"),null);
$this->assertEqual($user->get('name'),null);
$user->set("name","Jack");
$this->assertEqual($user->get("name"),"Jack");
$user->set('name', 'Jack');
$this->assertEqual($user->get('name'), 'Jack');
$user->save();
$user = $this->connection->getTable("User")->find($user->obtainIdentifier());
$user = $this->connection->getTable('User')->find($user->obtainIdentifier());
$this->assertEqual($user->get("name"),"Jack");
$this->assertEqual($user->get('name'), 'Jack');
$user->set("name","Jack");
$this->assertEqual($user->get("name"),"Jack");
$user->set('name', 'Jack');
$this->assertEqual($user->get('name'), 'Jack');
}
}
?>
<?php
require_once("UnitTestCase.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>.
*/
class Doctrine_BatchIteratorTestCase extends Doctrine_UnitTestCase {
/**
* Doctrine_BatchIterator_TestCase
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class Doctrine_BatchIterator_TestCase extends Doctrine_UnitTestCase {
public function prepareTables() {
$this->tables = array("Entity", "User","Group","Address","Phonenumber");
......
<?php
class Doctrine_BooleanTestCase extends Doctrine_UnitTestCase {
/*
* $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_Boolean_TestCase
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class Doctrine_Boolean_TestCase extends Doctrine_UnitTestCase {
public function prepareData() { }
public function prepareTables() {
$this->tables = array("BooleanTest");
......
<?php
class Doctrine_CollectionTestCase extends Doctrine_UnitTestCase {
/*
* $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_Collection_TestCase
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class Doctrine_Collection_TestCase extends Doctrine_UnitTestCase {
public function testLoadRelatedForAssociation() {
$coll = $this->connection->query("FROM User");
......
......@@ -7,11 +7,11 @@ class Doctrine_Configurable_TestCase extends Doctrine_UnitTestCase {
public function testGetIndexNameFormatAttribute() {
// default index name format is %_idx
$this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_IDXNAME_FORMAT), '%_idx');
$this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_IDXNAME_FORMAT), '%s_idx');
}
public function testGetSequenceNameFormatAttribute() {
// default sequence name format is %_seq
$this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_SEQNAME_FORMAT), '%_seq');
$this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_SEQNAME_FORMAT), '%s_seq');
}
public function testSetIndexNameFormatAttribute() {
$this->manager->setAttribute(Doctrine::ATTR_IDXNAME_FORMAT, '%_index');
......@@ -25,7 +25,7 @@ class Doctrine_Configurable_TestCase extends Doctrine_UnitTestCase {
}
public function testExceptionIsThrownWhenSettingIndexNameFormatAttributeAtTableLevel() {
try {
$this->connection->getTable('Entity')->setAttribute(Doctrine::ATTR_IDXNAME_FORMAT, '%_idx');
$this->connection->getTable('Entity')->setAttribute(Doctrine::ATTR_IDXNAME_FORMAT, '%s_idx');
$this->fail();
} catch(Doctrine_Exception $e) {
$this->pass();
......@@ -33,7 +33,7 @@ class Doctrine_Configurable_TestCase extends Doctrine_UnitTestCase {
}
public function testExceptionIsThrownWhenSettingSequenceNameFormatAttributeAtTableLevel() {
try {
$this->connection->getTable('Entity')->setAttribute(Doctrine::ATTR_SEQNAME_FORMAT, '%_seq');
$this->connection->getTable('Entity')->setAttribute(Doctrine::ATTR_SEQNAME_FORMAT, '%s_seq');
$this->fail();
} catch(Doctrine_Exception $e) {
$this->pass();
......@@ -86,6 +86,7 @@ class Doctrine_Configurable_TestCase extends Doctrine_UnitTestCase {
$this->manager->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, true);
$this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER), true);
$this->manager->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false);
}
public function testDefaultSequenceColumnNameAttributeValueIsId() {
$this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_SEQCOL_NAME), 'id');
......
<?php
class Doctrine_Connection_Sqlite_TestCase extends Doctrine_Driver_UnitTestCase {
class Doctrine_Connection_Sqlite_TestCase extends Doctrine_UnitTestCase {
public function __construct() {
parent::__construct('sqlite');
}
......
<?php
require_once("UnitTestCase.php");
class Doctrine_ConnectionTestCase extends Doctrine_UnitTestCase {
public function testBulkInsert() {
$u1 = new User();
$u1->name = "Jean Reno";
$u1->save();
$id = $u1->obtainIdentifier();
$u1->delete();
}
/*
* $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_Connection_TestCase
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class Doctrine_Connection_TestCase extends Doctrine_UnitTestCase {
public function testUnknownModule() {
try {
$this->connection->unknown;
......@@ -27,25 +49,25 @@ class Doctrine_ConnectionTestCase extends Doctrine_UnitTestCase {
}
public function testFlush() {
$user = $this->connection->getTable("User")->find(4);
$user = $this->connection->getTable('User')->find(4);
$this->assertTrue(is_numeric($user->Phonenumber[0]->entity_id));
$user = $this->connection->create("Email");
$user = $this->connection->create("User");
$record = $this->connection->create("Phonenumber");
$user = $this->connection->create('Email');
$user = $this->connection->create('User');
$record = $this->connection->create('Phonenumber');
$user->Email->address = "example@drinkmore.info";
$user->Email->address = 'example@drinkmore.info';
$this->assertTrue($user->email_id instanceof Email);
$user->name = "Example user";
$user->Group[0]->name = "Example group 1";
$user->Group[1]->name = "Example group 2";
$user->name = 'Example user';
$user->Group[0]->name = 'Example group 1';
$user->Group[1]->name = 'Example group 2';
$user->Phonenumber[0]->phonenumber = "123 123";
$user->Phonenumber[0]->phonenumber = '123 123';
$user->Phonenumber[1]->phonenumber = "321 2132";
$user->Phonenumber[2]->phonenumber = "123 123";
$user->Phonenumber[3]->phonenumber = "321 2132";
$user->Phonenumber[1]->phonenumber = '321 2132';
$user->Phonenumber[2]->phonenumber = '123 123';
$user->Phonenumber[3]->phonenumber = '321 2132';
......@@ -73,7 +95,7 @@ class Doctrine_ConnectionTestCase extends Doctrine_UnitTestCase {
$user = $this->objTable->find(5);
$pf = $this->connection->getTable("Phonenumber");
$pf = $this->connection->getTable('Phonenumber');
$this->assertTrue($user->Phonenumber instanceof Doctrine_Collection);
$this->assertTrue($user->Phonenumber->count() == 3);
......@@ -91,10 +113,10 @@ class Doctrine_ConnectionTestCase extends Doctrine_UnitTestCase {
// ADDING REFERENCES
$user->Phonenumber[0]->phonenumber = "123 123";
$user->Phonenumber[0]->phonenumber = '123 123';
$this->assertTrue(is_numeric($user->Phonenumber[0]->entity_id));
$user->Phonenumber[1]->phonenumber = "123 123";
$user->Phonenumber[1]->phonenumber = '123 123';
$this->connection->flush();
......@@ -104,7 +126,7 @@ class Doctrine_ConnectionTestCase extends Doctrine_UnitTestCase {
$user = $this->objTable->find(5);
$this->assertEqual($user->Phonenumber->count(), 2);
$user->Phonenumber[3]->phonenumber = "123 123";
$user->Phonenumber[3]->phonenumber = '123 123';
$this->connection->flush();
$this->assertEqual($user->Phonenumber->count(), 3);
......@@ -123,8 +145,8 @@ class Doctrine_ConnectionTestCase extends Doctrine_UnitTestCase {
// ADDING REFERENCES WITH STRING KEYS
$user->Phonenumber["home"]->phonenumber = "123 123";
$user->Phonenumber["work"]->phonenumber = "444 444";
$user->Phonenumber['home']->phonenumber = '123 123';
$user->Phonenumber['work']->phonenumber = '444 444';
$this->assertEqual($user->Phonenumber->count(), 2);
$this->connection->flush();
......@@ -138,9 +160,9 @@ class Doctrine_ConnectionTestCase extends Doctrine_UnitTestCase {
unset($coll);
$coll = new Doctrine_Collection($pf);
$coll[0]->phonenumber = "123 123";
$coll["home"]->phonenumber = "444 444";
$coll["work"]->phonenumber = "444 444";
$coll[0]->phonenumber = '123 123';
$coll['home']->phonenumber = '444 444';
$coll['work']->phonenumber = '444 444';
......@@ -154,28 +176,28 @@ class Doctrine_ConnectionTestCase extends Doctrine_UnitTestCase {
// ONE-TO-ONE REFERENCES
$user->Email->address = "drinker@drinkmore.info";
$user->Email->address = 'drinker@drinkmore.info';
$this->assertTrue($user->Email instanceof Email);
$this->connection->flush();
$this->assertTrue($user->Email instanceof Email);
$user = $this->objTable->find(5);
$this->assertEqual($user->Email->address, "drinker@drinkmore.info");
$this->assertEqual($user->Email->address, 'drinker@drinkmore.info');
$id = $user->Email->id;
// REPLACING ONE-TO-ONE REFERENCES
$email = $this->connection->create("Email");
$email->address = "absolutist@nottodrink.com";
$email = $this->connection->create('Email');
$email->address = 'absolutist@nottodrink.com';
$user->Email = $email;
$this->assertTrue($user->Email instanceof Email);
$this->assertEqual($user->Email->address, "absolutist@nottodrink.com");
$this->assertEqual($user->Email->address, 'absolutist@nottodrink.com');
$this->connection->flush();
unset($user);
$user = $this->objTable->find(5);
$this->assertTrue($user->Email instanceof Email);
$this->assertEqual($user->Email->address, "absolutist@nottodrink.com");
$this->assertEqual($user->Email->address, 'absolutist@nottodrink.com');
$emails = $this->connection->query("FROM Email WHERE Email.id = $id");
//$this->assertEqual(count($emails),0);
......@@ -187,31 +209,31 @@ class Doctrine_ConnectionTestCase extends Doctrine_UnitTestCase {
$this->assertEqual($this->connection->getManager(),$this->manager);
}
public function testQuery() {
$this->assertTrue($this->connection->query("FROM User") instanceof Doctrine_Collection);
$this->assertTrue($this->connection->query('FROM User') instanceof Doctrine_Collection);
}
public function testDelete() {
$user = $this->connection->create("User");
$user = $this->connection->create('User');
$this->connection->delete($user);
$this->assertEqual($user->getState(),Doctrine_Record::STATE_TCLEAN);
}
public function testGetTable() {
$table = $this->connection->getTable("Group");
$table = $this->connection->getTable('Group');
$this->assertTrue($table instanceof Doctrine_Table);
try {
$table = $this->connection->getTable("Unknown");
$table = $this->connection->getTable('Unknown');
$f = false;
} catch(Doctrine_Exception $e) {
$f = true;
}
$this->assertTrue($f);
$table = $this->connection->getTable("User");
$table = $this->connection->getTable('User');
$this->assertTrue($table instanceof UserTable);
}
public function testCreate() {
$email = $this->connection->create("Email");
$email = $this->connection->create('Email');
$this->assertTrue($email instanceof Email);
}
public function testGetDbh() {
......@@ -225,7 +247,7 @@ class Doctrine_ConnectionTestCase extends Doctrine_UnitTestCase {
}
public function testGetState() {
$this->assertEqual($this->connection->transaction->getState(),Doctrine_Transaction::STATE_SLEEP);
$this->assertEqual(Doctrine_Lib::getConnectionStateAsString($this->connection->transaction->getState()), "open");
$this->assertEqual(Doctrine_Lib::getConnectionStateAsString($this->connection->transaction->getState()), 'open');
}
public function testGetTables() {
$this->assertTrue(is_array($this->connection->getTables()));
......@@ -242,12 +264,12 @@ class Doctrine_ConnectionTestCase extends Doctrine_UnitTestCase {
$user = $this->objTable->find(6);
$user->name = "Jack Daniels";
$user->name = 'Jack Daniels';
$this->connection->flush();
$this->connection->commit();
$user = $this->objTable->find(6);
$this->assertEqual($user->name, "Jack Daniels");
$this->assertEqual($user->name, 'Jack Daniels');
}
......
<?php
require_once("UnitTestCase.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>.
*/
class Doctrine_CustomPrimaryKeyTestCase extends Doctrine_UnitTestCase {
/**
* Doctrine_CustomPrimaryKey_TestCase
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class Doctrine_CustomPrimaryKey_TestCase extends Doctrine_UnitTestCase {
public function prepareData() { }
public function prepareTables() {
......
<?PHP
class Doctrine_CustomResultSetOrderTestCase extends Doctrine_UnitTestCase {
<?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_CustomResultSetOrder_TestCase
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class Doctrine_CustomResultSetOrder_TestCase extends Doctrine_UnitTestCase {
/**
* Prepares the data under test.
......
......@@ -15,7 +15,7 @@ class AdapterMock implements Doctrine_Adapter_Interface {
public function pop() {
return array_pop($this->queries);
}
public function forceException($name, $message, $code) {
public function forceException($name, $message = '', $code = 0) {
$this->exception = array($name, $message, $code);
}
public function prepare($prepareString){
......@@ -69,7 +69,7 @@ class AdapterMock implements Doctrine_Adapter_Interface {
public function errorInfo(){ }
public function getAttribute($attribute) {
if($attribute == PDO::ATTR_DRIVER_NAME)
return $this->name;
return strtolower($this->name);
}
public function setAttribute($attribute, $value) {
......@@ -82,6 +82,9 @@ class AdapterStatementMock {
public function fetchAll($fetchMode) {
return array();
}
public function execute() {
return true;
}
}
class Doctrine_Driver_UnitTestCase extends UnitTestCase {
protected $driverName = false;
......@@ -107,6 +110,9 @@ class Doctrine_Driver_UnitTestCase extends UnitTestCase {
public function getDeclaration($type) {
return $this->dataDict->getPortableDeclaration(array('type' => $type, 'name' => 'colname', 'length' => 1, 'fixed' => true));
}
public function setDriverName($driverName) {
$this->driverName = $driverName;
}
public function init() {
$this->adapter = new AdapterMock($this->driverName);
$this->manager = Doctrine_Manager::getInstance();
......@@ -123,7 +129,10 @@ class Doctrine_Driver_UnitTestCase extends UnitTestCase {
$tx = 'Doctrine_Transaction_' . ucwords($name);
$dataDict = 'Doctrine_DataDict_' . ucwords($name);
$exc = 'Doctrine_Connection_' . ucwords($name) . '_Exception';
$this->exc = new $exc();
if(class_exists($tx))
$this->transaction = new $tx($this->conn);
if(class_exists($dataDict)) {
......
<?php
class Doctrine_EnumTestCase extends Doctrine_UnitTestCase {
/*
* $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_Enum_TestCase
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class Doctrine_Enum_TestCase extends Doctrine_UnitTestCase {
public function prepareData() { }
public function prepareTables() {
$this->tables = array("EnumTest");
......
<?php
require_once("UnitTestCase.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_EventListener_Chain_TestCase
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class EventListenerChainTest extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn("name", "string", 100);
......
<?php
require_once("UnitTestCase.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_EventListener_TestCase
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class EventListenerTest extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn("name", "string", 100);
......@@ -36,7 +66,7 @@ class Doctrine_EventListener_TestLogger implements Doctrine_Overloadable, Counta
}
}
class Doctrine_EventListenerTestCase extends Doctrine_UnitTestCase {
class Doctrine_EventListener_TestCase extends Doctrine_UnitTestCase {
private $logger;
......
......@@ -11,9 +11,16 @@ class Doctrine_Export_Reporter_TestCase extends Doctrine_Driver_UnitTestCase {
}
public function testExportChecksClassNaming() {
$reporter = $this->export->export('BadLyNamed__Class');
// Class name is not valid. Double underscores are not allowed
$this->assertEqual($reporter->pop(), array(E_WARNING, 'Badly named class.'));
}
public function testExportReportsExceptions() {
$reporter = $this->export->export('User');
// Class name is not valid. Double underscores are not allowed
$this->assertEqual($reporter->pop(), array(E_WARNING, Doctrine::ERR_CLASS_NAME));
}
}
}
<?php
class Doctrine_Export_TestCase extends Doctrine_Driver_UnitTestCase {
class Doctrine_Export_TestCase extends Doctrine_UnitTestCase {
public function testCreateTableThrowsExceptionWithoutValidTableName() {
try {
$this->export->createTable(0, array(), array());
......@@ -22,13 +20,13 @@ class Doctrine_Export_TestCase extends Doctrine_Driver_UnitTestCase {
}
public function testDropConstraintExecutesSql() {
$this->export->dropConstraint('sometable', 'relevancy');
$this->assertEqual($this->adapter->pop(), 'ALTER TABLE sometable DROP CONSTRAINT relevancy_idx');
}
public function testCreateIndexExecutesSql() {
$this->export->createIndex('sometable', 'relevancy', array('fields' => array('title' => array(), 'content' => array())));
$this->assertEqual($this->adapter->pop(), 'CREATE INDEX relevancy ON sometable (title, content)');
$this->assertEqual($this->adapter->pop(), 'CREATE INDEX relevancy_idx ON sometable (title, content)');
}
public function testDropIndexExecutesSql() {
......
<?php
require_once("UnitTestCase.php");
class Doctrine_ManagerTestCase extends Doctrine_UnitTestCase {
/*
* $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_Manager_TestCase
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class Doctrine_Manager_TestCase extends Doctrine_UnitTestCase {
public function testGetInstance() {
$this->assertTrue(Doctrine_Manager::getInstance() instanceOf Doctrine_Manager);
}
......
<?PHP
<?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>.
*/
require_once("UnitTestCase.php");
class Doctrine_PessimisticLockingTestCase extends Doctrine_UnitTestCase {
/**
* Doctrine_Boolean_TestCase
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class Doctrine_PessimisticLocking_TestCase extends Doctrine_UnitTestCase {
private $lockingManager;
/**
......
<?php
class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase {
public function prepareTables() { }
public function prepareData() { }
public function testAssignUnknownState() {
$user = new User();
try {
$user->state(123123);
$this->fail();
} catch(Doctrine_Record_State_Exception $e) {
$this->pass();
}
$this->assertEqual($user->state(), Doctrine_Record::STATE_TCLEAN);
try {
$user->state('some unknown state');
$this->fail();
} catch(Doctrine_Record_State_Exception $e) {
$this->pass();
}
$this->assertEqual($user->state(), Doctrine_Record::STATE_TCLEAN);
}
public function testAssignDirtyState() {
$user = new User();
$user->state(Doctrine_Record::STATE_DIRTY);
$this->assertEqual($user->state(), Doctrine_Record::STATE_DIRTY);
$user->state('dirty');
$this->assertEqual($user->state(), Doctrine_Record::STATE_DIRTY);
}
public function testAssignCleanState() {
$user = new User();
$user->state(Doctrine_Record::STATE_CLEAN);
$this->assertEqual($user->state(), Doctrine_Record::STATE_CLEAN);
$user->state('clean');
$this->assertEqual($user->state(), Doctrine_Record::STATE_CLEAN);
}
public function testAssignTransientCleanState() {
$user = new User();
$user->state(Doctrine_Record::STATE_TCLEAN);
$this->assertEqual($user->state(), Doctrine_Record::STATE_TCLEAN);
$user->state('tclean');
$this->assertEqual($user->state(), Doctrine_Record::STATE_TCLEAN);
}
public function testAssignTransientDirtyState() {
$user = new User();
$user->state(Doctrine_Record::STATE_TDIRTY);
$this->assertEqual($user->state(), Doctrine_Record::STATE_TDIRTY);
$user->state('tdirty');
$this->assertEqual($user->state(), Doctrine_Record::STATE_TDIRTY);
}
public function testAssignProxyState() {
$user = new User();
$user->state(Doctrine_Record::STATE_PROXY);
$this->assertEqual($user->state(), Doctrine_Record::STATE_PROXY);
$user->state('proxy');
$this->assertEqual($user->state(), Doctrine_Record::STATE_PROXY);
}
}
?>
<?php
require_once("UnitTestCase.php");
class Doctrine_TableTestCase extends Doctrine_UnitTestCase {
/*
* $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_Table_TestCase
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class Doctrine_Table_TestCase extends Doctrine_UnitTestCase {
public function prepareTables() {
$this->tables[] = "FieldNameTest";
parent::prepareTables();
......
<?php
class Doctrine_Transaction_Firebird_TestCase extends Doctrine_Driver_UnitTestCase {
public function __construct() {
parent::__construct('firebird');
}
public function testCreateSavePointExecutesSql() {
$this->transaction->beginTransaction('mypoint');
$this->assertEqual($this->adapter->pop(), 'SAVEPOINT mypoint');
}
public function testReleaseSavePointExecutesSql() {
$this->transaction->commit('mypoint');
$this->assertEqual($this->adapter->pop(), 'RELEASE SAVEPOINT mypoint');
}
public function testRollbackSavePointExecutesSql() {
$this->transaction->beginTransaction('mypoint');
$this->transaction->rollback('mypoint');
$this->assertEqual($this->adapter->pop(), 'ROLLBACK TO SAVEPOINT mypoint');
}
public function testSetIsolationThrowsExceptionOnUnknownIsolationMode() {
try {
$this->transaction->setIsolation('unknown');
$this->fail();
} catch(Doctrine_Transaction_Exception $e) {
$this->pass();
}
}
public function testSetIsolationThrowsExceptionOnUnknownWaitMode() {
try {
$this->transaction->setIsolation('READ UNCOMMITTED', array('wait' => 'unknown'));
$this->fail();
} catch(Doctrine_Transaction_Exception $e) {
$this->pass();
}
}
public function testSetIsolationThrowsExceptionOnUnknownReadWriteMode() {
try {
$this->transaction->setIsolation('READ UNCOMMITTED', array('rw' => 'unknown'));
$this->fail();
} catch(Doctrine_Transaction_Exception $e) {
$this->pass();
}
}
public function testSetIsolationExecutesSql() {
$this->transaction->setIsolation('READ UNCOMMITTED');
$this->transaction->setIsolation('READ COMMITTED');
$this->transaction->setIsolation('REPEATABLE READ');
$this->transaction->setIsolation('SERIALIZABLE');
$this->assertEqual($this->adapter->pop(), 'SET TRANSACTION ISOLATION LEVEL SNAPSHOT TABLE STABILITY');
$this->assertEqual($this->adapter->pop(), 'SET TRANSACTION ISOLATION LEVEL SNAPSHOT');
$this->assertEqual($this->adapter->pop(), 'SET TRANSACTION ISOLATION LEVEL READ COMMITTED NO RECORD_VERSION');
$this->assertEqual($this->adapter->pop(), 'SET TRANSACTION ISOLATION LEVEL READ COMMITTED RECORD_VERSION');
}
public function testSetIsolationSupportsReadWriteOptions() {
$this->transaction->setIsolation('SERIALIZABLE', array('rw' => 'READ ONLY'));
$this->assertEqual($this->adapter->pop(), 'SET TRANSACTION READ ONLY ISOLATION LEVEL SNAPSHOT TABLE STABILITY');
$this->transaction->setIsolation('SERIALIZABLE', array('rw' => 'READ WRITE'));
$this->assertEqual($this->adapter->pop(), 'SET TRANSACTION READ WRITE ISOLATION LEVEL SNAPSHOT TABLE STABILITY');
}
public function testSetIsolationSupportsWaitOptions() {
$this->transaction->setIsolation('SERIALIZABLE', array('wait' => 'NO WAIT'));
$this->assertEqual($this->adapter->pop(), 'SET TRANSACTION NO WAIT ISOLATION LEVEL SNAPSHOT TABLE STABILITY');
$this->transaction->setIsolation('SERIALIZABLE', array('wait' => 'WAIT'));
$this->assertEqual($this->adapter->pop(), 'SET TRANSACTION WAIT ISOLATION LEVEL SNAPSHOT TABLE STABILITY');
}
}
<?php
class Doctrine_Transaction_Mssql_TestCase extends Doctrine_Driver_UnitTestCase {
public function __construct() {
parent::__construct('mssql');
}
public function testSetIsolationThrowsExceptionOnUnknownIsolationMode() {
try {
$this->transaction->setIsolation('unknown');
$this->fail();
} catch(Doctrine_Transaction_Exception $e) {
$this->pass();
}
}
public function testSetIsolationExecutesSql() {
$this->transaction->setIsolation('READ UNCOMMITTED');
$this->transaction->setIsolation('READ COMMITTED');
$this->transaction->setIsolation('REPEATABLE READ');
$this->transaction->setIsolation('SERIALIZABLE');
$this->assertEqual($this->adapter->pop(), 'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE');
$this->assertEqual($this->adapter->pop(), 'SET TRANSACTION ISOLATION LEVEL REPEATABLE READ');
$this->assertEqual($this->adapter->pop(), 'SET TRANSACTION ISOLATION LEVEL READ COMMITTED');
$this->assertEqual($this->adapter->pop(), 'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED');
}
public function testSetIsolationSupportsSnapshotMode() {
$this->transaction->setIsolation('SNAPSHOT');
$this->assertEqual($this->adapter->pop(), 'SET TRANSACTION ISOLATION LEVEL SNAPSHOT');
}
}
<?php
class Doctrine_Transaction_Mysql_TestCase extends Doctrine_Driver_UnitTestCase {
public function __construct() {
parent::__construct('mysql');
}
public function testCreateSavePointExecutesSql() {
$this->transaction->beginTransaction('mypoint');
$this->assertEqual($this->adapter->pop(), 'SAVEPOINT mypoint');
}
public function testReleaseSavePointExecutesSql() {
$this->transaction->commit('mypoint');
$this->assertEqual($this->adapter->pop(), 'RELEASE SAVEPOINT mypoint');
}
public function testRollbackSavePointExecutesSql() {
$this->transaction->beginTransaction('mypoint');
$this->transaction->rollback('mypoint');
$this->assertEqual($this->adapter->pop(), 'ROLLBACK TO SAVEPOINT mypoint');
}
public function testGetIsolationExecutesSql() {
$this->transaction->getIsolation();
$this->assertEqual($this->adapter->pop(), 'SELECT @@tx_isolation');
}
public function testSetIsolationThrowsExceptionOnUnknownIsolationMode() {
try {
$this->transaction->setIsolation('unknown');
$this->fail();
} catch(Doctrine_Transaction_Exception $e) {
$this->pass();
}
}
public function testSetIsolationExecutesSql() {
$this->transaction->setIsolation('READ UNCOMMITTED');
$this->assertEqual($this->adapter->pop(), 'SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED');
}
}
<?php
class Doctrine_Transaction_Oracle_TestCase extends Doctrine_Driver_UnitTestCase {
public function __construct() {
parent::__construct('oci');
}
public function testCreateSavePointExecutesSql() {
$this->transaction->beginTransaction('mypoint');
$this->assertEqual($this->adapter->pop(), 'SAVEPOINT mypoint');
}
public function testReleaseSavePointAlwaysReturnsTrue() {
$this->assertEqual($this->transaction->commit('mypoint'), true);
}
public function testRollbackSavePointExecutesSql() {
$this->transaction->beginTransaction('mypoint');
$this->transaction->rollback('mypoint');
$this->assertEqual($this->adapter->pop(), 'ROLLBACK TO SAVEPOINT mypoint');
}
public function testSetIsolationThrowsExceptionOnUnknownIsolationMode() {
try {
$this->transaction->setIsolation('unknown');
$this->fail();
} catch(Doctrine_Transaction_Exception $e) {
$this->pass();
}
}
public function testSetIsolationExecutesSql() {
$this->transaction->setIsolation('READ UNCOMMITTED');
$this->transaction->setIsolation('READ COMMITTED');
$this->transaction->setIsolation('REPEATABLE READ');
$this->transaction->setIsolation('SERIALIZABLE');
$this->assertEqual($this->adapter->pop(), 'ALTER SESSION ISOLATION LEVEL SERIALIZABLE');
$this->assertEqual($this->adapter->pop(), 'ALTER SESSION ISOLATION LEVEL SERIALIZABLE');
$this->assertEqual($this->adapter->pop(), 'ALTER SESSION ISOLATION LEVEL SERIALIZABLE');
$this->assertEqual($this->adapter->pop(), 'ALTER SESSION ISOLATION LEVEL READ COMMITTED');
}
}
<?php
class Doctrine_Transaction_Pgsql_TestCase extends Doctrine_Driver_UnitTestCase {
public function __construct() {
parent::__construct('pgsql');
}
public function testCreateSavePointExecutesSql() {
$this->transaction->beginTransaction('mypoint');
$this->assertEqual($this->adapter->pop(), 'SAVEPOINT mypoint');
}
public function testReleaseSavePointExecutesSql() {
$this->transaction->commit('mypoint');
$this->assertEqual($this->adapter->pop(), 'RELEASE SAVEPOINT mypoint');
}
public function testRollbackSavePointExecutesSql() {
$this->transaction->beginTransaction('mypoint');
$this->transaction->rollback('mypoint');
$this->assertEqual($this->adapter->pop(), 'ROLLBACK TO SAVEPOINT mypoint');
}
public function testSetIsolationThrowsExceptionOnUnknownIsolationMode() {
try {
$this->transaction->setIsolation('unknown');
$this->fail();
} catch(Doctrine_Transaction_Exception $e) {
$this->pass();
}
}
public function testSetIsolationExecutesSql() {
$this->transaction->setIsolation('READ UNCOMMITTED');
$this->assertEqual($this->adapter->pop(), 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ UNCOMMITTED');
}
}
<?php
class Doctrine_Transaction_Sqlite_TestCase extends Doctrine_Driver_UnitTestCase {
public function __construct() {
parent::__construct('sqlite');
}
public function testSetIsolationThrowsExceptionOnUnknownIsolationMode() {
try {
$this->transaction->setIsolation('unknown');
$this->fail();
} catch(Doctrine_Transaction_Exception $e) {
$this->pass();
}
}
public function testSetIsolationExecutesSql() {
$this->transaction->setIsolation('READ UNCOMMITTED');
$this->transaction->setIsolation('READ COMMITTED');
$this->transaction->setIsolation('REPEATABLE READ');
$this->transaction->setIsolation('SERIALIZABLE');
$this->assertEqual($this->adapter->pop(), 'PRAGMA read_uncommitted = 1');
$this->assertEqual($this->adapter->pop(), 'PRAGMA read_uncommitted = 1');
$this->assertEqual($this->adapter->pop(), 'PRAGMA read_uncommitted = 1');
$this->assertEqual($this->adapter->pop(), 'PRAGMA read_uncommitted = 0');
}
}
<?php
require_once dirname(__FILE__).'/../lib/Doctrine.php';
//Doctrine::compile();
//require_once("../Doctrine.compiled.php");
//Doctrine::loadAll();
//ini_set('include_path', $_SERVER['DOCUMENT_ROOT']);
function __autoload($class) {
Doctrine::autoload($class);
}
require_once("classes.php");
require_once("simpletest/unit_tester.php");
require_once("simpletest/reporter.php");
class Doctrine_UnitTestCase extends UnitTestCase {
protected $manager;
protected $connection;
......@@ -31,6 +12,14 @@ class Doctrine_UnitTestCase extends UnitTestCase {
protected $valueHolder;
protected $tables = array();
protected $unitOfWork;
protected $driverName = false;
protected $generic = false;
protected $conn;
protected $adapter;
protected $export;
protected $dataDict;
protected $transaction;
private $init = false;
......@@ -62,24 +51,68 @@ class Doctrine_UnitTestCase extends UnitTestCase {
);
$class = get_class($this);
$e = explode('_', $class);
$this->driverName = 'main';
switch($e[1]) {
case 'Export':
case 'Import':
case 'Expression':
case 'Transaction':
case 'DataDict':
$this->driverName = 'Sqlite';
break;
}
if(count($e) > 3) {
$driver = $e[2];
switch($e[2]) {
case 'Firebird':
case 'Informix':
case 'Mysql':
case 'Mssql':
case 'Oracle':
case 'Pgsql':
case 'Sqlite':
$this->driverName = $e[2];
break;
}
}
try {
$this->connection = $this->manager->getConnection('main');
$this->connection = $this->manager->getConnection($this->driverName);
$this->connection->evictTables();
$this->dbh = $this->connection->getDBH();
$this->dbh = $this->adapter = $this->connection->getDbh();
$this->listener = $this->manager->getAttribute(Doctrine::ATTR_LISTENER);
$this->manager->setAttribute(Doctrine::ATTR_LISTENER, $this->listener);
} catch(Doctrine_Manager_Exception $e) {
//$this->dbh = Doctrine_Db::getConnection();
$this->dbh = Doctrine_Db::getConnection("sqlite::memory:");
//$this->dbh = new PDO("sqlite::memory:");
if($this->driverName == 'main') {
$this->dbh = Doctrine_Db::getConnection("sqlite::memory:");
} else {
$this->dbh = $this->adapter = new AdapterMock($this->driverName);
}
$this->connection = $this->manager->openConnection($this->dbh, 'main');
$this->connection = $this->manager->openConnection($this->dbh, $this->driverName);
if($this->driverName !== 'main') {
$exc = 'Doctrine_Connection_' . ucwords($this->driverName) . '_Exception';
$this->exc = new $exc();
} else {
}
$this->listener = new Doctrine_EventListener_Debugger();
$this->manager->setAttribute(Doctrine::ATTR_LISTENER, $this->listener);
}
if($this->driverName !== 'main') {
$this->export = $this->connection->export;
$this->transaction = $this->connection->transaction;
$this->dataDict = $this->connection->dataDict;
}
$this->unitOfWork = $this->connection->unitOfWork;
$this->connection->setListener(new Doctrine_EventListener());
$this->query = new Doctrine_Query($this->connection);
......@@ -91,7 +124,7 @@ class Doctrine_UnitTestCase extends UnitTestCase {
}
public function prepareTables() {
foreach($this->tables as $name) {
$query = "DROP TABLE ".Doctrine::tableize($name);
$query = 'DROP TABLE ' . Doctrine::tableize($name);
try {
$this->dbh->query($query);
} catch(PDOException $e) {
......@@ -106,61 +139,61 @@ class Doctrine_UnitTestCase extends UnitTestCase {
$table->clear();
}
$this->objTable = $this->connection->getTable("User");
$this->objTable = $this->connection->getTable('User');
}
public function prepareData() {
$groups = new Doctrine_Collection($this->connection->getTable("Group"));
$groups = new Doctrine_Collection($this->connection->getTable('Group'));
$groups[0]->name = "Drama Actors";
$groups[0]->name = 'Drama Actors';
$groups[1]->name = "Quality Actors";
$groups[1]->name = 'Quality Actors';
$groups[2]->name = "Action Actors";
$groups[2]["Phonenumber"][0]->phonenumber = "123 123";
$groups[2]->name = 'Action Actors';
$groups[2]['Phonenumber'][0]->phonenumber = '123 123';
$groups->save();
$users = new Doctrine_Collection($this->connection->getTable("User"));
$users = new Doctrine_Collection('User');
$users[0]->name = "zYne";
$users[0]["Email"]->address = "zYne@example.com";
$users[0]["Phonenumber"][0]->phonenumber = "123 123";
$users[0]->name = 'zYne';
$users[0]['Email']->address = 'zYne@example.com';
$users[0]['Phonenumber'][0]->phonenumber = '123 123';
$users[1]->name = "Arnold Schwarzenegger";
$users[1]->Email->address = "arnold@example.com";
$users[1]["Phonenumber"][0]->phonenumber = "123 123";
$users[1]["Phonenumber"][1]->phonenumber = "456 456";
$users[1]->Phonenumber[2]->phonenumber = "789 789";
$users[1]->name = 'Arnold Schwarzenegger';
$users[1]->Email->address = 'arnold@example.com';
$users[1]['Phonenumber'][0]->phonenumber = '123 123';
$users[1]['Phonenumber'][1]->phonenumber = '456 456';
$users[1]->Phonenumber[2]->phonenumber = '789 789';
$users[1]->Group[0] = $groups[2];
$users[2]->name = "Michael Caine";
$users[2]->Email->address = "caine@example.com";
$users[2]->Phonenumber[0]->phonenumber = "123 123";
$users[3]->name = "Takeshi Kitano";
$users[3]->Email->address = "kitano@example.com";
$users[3]->Phonenumber[0]->phonenumber = "111 222 333";
$users[4]->name = "Sylvester Stallone";
$users[4]->Email->address = "stallone@example.com";
$users[4]->Phonenumber[0]->phonenumber = "111 555 333";
$users[4]["Phonenumber"][1]->phonenumber = "123 213";
$users[4]["Phonenumber"][2]->phonenumber = "444 555";
$users[5]->name = "Kurt Russell";
$users[5]->Email->address = "russell@example.com";
$users[5]->Phonenumber[0]->phonenumber = "111 222 333";
$users[6]->name = "Jean Reno";
$users[6]->Email->address = "reno@example.com";
$users[6]->Phonenumber[0]->phonenumber = "111 222 333";
$users[6]["Phonenumber"][1]->phonenumber = "222 123";
$users[6]["Phonenumber"][2]->phonenumber = "123 456";
$users[7]->name = "Edward Furlong";
$users[7]->Email->address = "furlong@example.com";
$users[7]->Phonenumber[0]->phonenumber = "111 567 333";
$users[2]->name = 'Michael Caine';
$users[2]->Email->address = 'caine@example.com';
$users[2]->Phonenumber[0]->phonenumber = '123 123';
$users[3]->name = 'Takeshi Kitano';
$users[3]->Email->address = 'kitano@example.com';
$users[3]->Phonenumber[0]->phonenumber = '111 222 333';
$users[4]->name = 'Sylvester Stallone';
$users[4]->Email->address = 'stallone@example.com';
$users[4]->Phonenumber[0]->phonenumber = '111 555 333';
$users[4]['Phonenumber'][1]->phonenumber = '123 213';
$users[4]['Phonenumber'][2]->phonenumber = '444 555';
$users[5]->name = 'Kurt Russell';
$users[5]->Email->address = 'russell@example.com';
$users[5]->Phonenumber[0]->phonenumber = '111 222 333';
$users[6]->name = 'Jean Reno';
$users[6]->Email->address = 'reno@example.com';
$users[6]->Phonenumber[0]->phonenumber = '111 222 333';
$users[6]['Phonenumber'][1]->phonenumber = '222 123';
$users[6]['Phonenumber'][2]->phonenumber = '123 456';
$users[7]->name = 'Edward Furlong';
$users[7]->Email->address = 'furlong@example.com';
$users[7]->Phonenumber[0]->phonenumber = '111 567 333';
$this->users = $users;
$this->connection->flush();
......
<?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_Validator_TestCase
* TestCase for Doctrine's validation component.
*
* @todo More tests to cover the full interface of Doctrine_Validator_ErrorStack.
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class Doctrine_ValidatorTestCase extends Doctrine_UnitTestCase {
class Doctrine_Validator_TestCase extends Doctrine_UnitTestCase {
public function prepareTables() {
$this->tables[] = "ValidatorTest";
parent::prepareTables();
......
<?php
class Doctrine_ViewTestCase extends Doctrine_UnitTestCase {
/*
* $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_View_TestCase
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class Doctrine_View_TestCase extends Doctrine_UnitTestCase {
public function testCreateView() {
$query = new Doctrine_Query($this->connection);
$query->from('User');
......
......@@ -2,241 +2,163 @@
ob_start();
require_once('ConfigurableTestCase.php');
require_once('DriverTestCase.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('HookTestCase.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('QueryShortAliasesTestCase.php');
require_once('QueryDeleteTestCase.php');
require_once('QueryUpdateTestCase.php');
require_once('QueryIdentifierQuotingTestCase.php');
require_once('QueryAggregateValueTestCase.php');
require_once('UnitOfWorkTestCase.php');
require_once('RelationAccessTestCase.php');
require_once('RelationTestCase.php');
require_once('RelationManyToManyTestCase.php');
require_once('DBTestCase.php');
require_once('DbProfilerTestCase.php');
require_once('SchemaTestCase.php');
require_once('ImportTestCase.php');
require_once('BooleanTestCase.php');
require_once('EnumTestCase.php');
require_once('DataDictSqliteTestCase.php');
$drivers = array('Firebird',
'Informix',
'Mysql',
'Mssql',
'Oracle',
'Pgsql',
'Sqlite'
);
foreach($drivers as $driver) {
require_once('DataDict/' . $driver . 'TestCase.php');
}
/**
class Doctrine_Tester {
protected $drivers = array('Firebird',
'Informix',
'Mysql',
'Mssql',
'Oracle',
'Pgsql',
'Sqlite'
);
public function loadModule($module) {
foreach($drivers as $driver) {
require_once($module . DIRECTORY_SEPARATOR . $driver . 'TestCase.php');
}
}
public function run($module) {
$this->loadModule($module);
function autoload($class) {
if(strpos($class, 'TestCase') === false)
return false;
foreach($drivers as $driver) {
$e = explode('_', $class);
$count = count($e);
}
}
}
*/
require_once('ExportTestCase.php');
require_once('ExportReporterTestCase.php');
require_once('ExportMysqlTestCase.php');
require_once('ExportFirebirdTestCase.php');
require_once('ExportPgsqlTestCase.php');
require_once('ExportOracleTestCase.php');
require_once('ExportSqliteTestCase.php');
require_once('TransactionTestCase.php');
require_once('TransactionMysqlTestCase.php');
require_once('TransactionPgsqlTestCase.php');
require_once('TransactionOracleTestCase.php');
require_once('TransactionFirebirdTestCase.php');
require_once('TransactionMssqlTestCase.php');
require_once('TransactionSqliteTestCase.php');
require_once('Connection/MysqlTestCase.php');
require_once('CustomResultSetOrderTestCase.php');
array_shift($e);
error_reporting(E_ALL);
print '<pre>';
$dir = array_shift($e);
$test = new GroupTest('Doctrine Framework Unit Tests');
$file = $dir . '_' . substr(implode('_', $e), 0, -(strlen('_TestCase'))) . 'TestCase.php';
/**
$test->addTestCase(new Doctrine_Export_Sqlite_TestCase());
foreach($drivers as $driver) {
$class = 'Doctrine_DataDict_' . $driver . '_TestCase';
if($count > 3) {
$file = str_replace('_', DIRECTORY_SEPARATOR, $file);
} else {
$file = str_replace('_', '', $file);
}
$test->addTestCase(new $class());
}
// 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);
}
$test->addTestCase(new Doctrine_Connection_Mysql_TestCase());
file_put_contents($file, $contents);
}
require_once($file);
return true;
}
$test->addTestCase(new Doctrine_Export_Mysql_TestCase());
require_once dirname(__FILE__) . '/../lib/Doctrine.php';
$test->addTestCase(new Doctrine_Export_Oracle_TestCase());
spl_autoload_register(array('Doctrine', 'autoload'));
spl_autoload_register('autoload');
$test->addTestCase(new Doctrine_Export_Pgsql_TestCase());
require_once('classes.php');
require_once('simpletest/unit_tester.php');
require_once('simpletest/reporter.php');
require_once('UnitTestCase.php');
require_once('DriverTestCase.php');
$test->addTestCase(new Doctrine_Export_Firebird_TestCase());
error_reporting(E_ALL);
print '<pre>';
$test = new GroupTest('Doctrine Framework Unit Tests');
$test->addTestCase(new Doctrine_Configurable_TestCase());
// DATABASE ABSTRACTION tests
$test->addTestCase(new Doctrine_Export_Sqlite_TestCase());
*/
$test->addTestCase(new Doctrine_Connection_Firebird_TestCase());
$test->addTestCase(new Doctrine_Connection_Informix_TestCase());
$test->addTestCase(new Doctrine_Connection_Mysql_TestCase());
$test->addTestCase(new Doctrine_Connection_Mssql_TestCase());
$test->addTestCase(new Doctrine_Connection_Pgsql_TestCase());
$test->addTestCase(new Doctrine_Connection_Oracle_TestCase());
$test->addTestCase(new Doctrine_Connection_Sqlite_TestCase());
$test->addTestCase(new Doctrine_Export_TestCase());
$test->addTestCase(new Doctrine_Export_Reporter_TestCase());
$test->addTestCase(new Doctrine_Export_Firebird_TestCase());
$test->addTestCase(new Doctrine_Export_Informix_TestCase());
$test->addTestCase(new Doctrine_Export_Mysql_TestCase());
$test->addTestCase(new Doctrine_Export_Mssql_TestCase());
$test->addTestCase(new Doctrine_Export_Pgsql_TestCase());
$test->addTestCase(new Doctrine_Export_Oracle_TestCase());
$test->addTestCase(new Doctrine_Export_Sqlite_TestCase());
$test->addTestCase(new Doctrine_Transaction_TestCase());
$test->addTestCase(new Doctrine_Transaction_Firebird_TestCase());
$test->addTestCase(new Doctrine_Transaction_Informix_TestCase());
$test->addTestCase(new Doctrine_Transaction_Mysql_TestCase());
$test->addTestCase(new Doctrine_Transaction_Mssql_TestCase());
$test->addTestCase(new Doctrine_Transaction_Pgsql_TestCase());
$test->addTestCase(new Doctrine_Transaction_Oracle_TestCase());
$test->addTestCase(new Doctrine_Transaction_Sqlite_TestCase());
$test->addTestCase(new Doctrine_Transaction_Firebird_TestCase());
//$test->addTestCase(new Doctrine_Import_TestCase());
$test->addTestCase(new Doctrine_Import_Firebird_TestCase());
$test->addTestCase(new Doctrine_Import_Informix_TestCase());
$test->addTestCase(new Doctrine_Import_Mysql_TestCase());
$test->addTestCase(new Doctrine_Import_Mssql_TestCase());
$test->addTestCase(new Doctrine_Import_Pgsql_TestCase());
$test->addTestCase(new Doctrine_Import_Oracle_TestCase());
$test->addTestCase(new Doctrine_Import_Sqlite_TestCase());
$test->addTestCase(new Doctrine_Expression_TestCase());
$test->addTestCase(new Doctrine_Expression_Firebird_TestCase());
$test->addTestCase(new Doctrine_Expression_Informix_TestCase());
$test->addTestCase(new Doctrine_Expression_Mysql_TestCase());
$test->addTestCase(new Doctrine_Expression_Mssql_TestCase());
$test->addTestCase(new Doctrine_Expression_Pgsql_TestCase());
$test->addTestCase(new Doctrine_Expression_Oracle_TestCase());
$test->addTestCase(new Doctrine_Expression_Sqlite_TestCase());
// Core
$test->addTestCase(new Doctrine_Access_TestCase());
//$test->addTestCase(new Doctrine_Configurable_TestCase());
$test->addTestCase(new Doctrine_Manager_TestCase());
$test->addTestCase(new Doctrine_Connection_TestCase());
$test->addTestCase(new Doctrine_Table_TestCase());
$test->addTestCase(new Doctrine_Transaction_Sqlite_TestCase());
$test->addTestCase(new Doctrine_UnitOfWork_TestCase());
$test->addTestCase(new Doctrine_Connection_Transaction_TestCase());
$test->addTestCase(new Doctrine_Collection_TestCase());
$test->addTestCase(new Doctrine_Transaction_Mssql_TestCase());
// Relation handling
$test->addTestCase(new Doctrine_Relation_TestCase());
$test->addTestCase(new Doctrine_Relation_Access_TestCase());
$test->addTestCase(new Doctrine_Relation_ManyToMany_TestCase());
$test->addTestCase(new Doctrine_PessimisticLockingTestCase());
$test->addTestCase(new Doctrine_BooleanTestCase());
$test->addTestCase(new Doctrine_TableTestCase());
// Datatypes
$test->addTestCase(new Doctrine_Enum_TestCase());
$test->addTestCase(new Doctrine_Boolean_TestCase());
$test->addTestCase(new Doctrine_ValidatorTestCase());
$test->addTestCase(new Doctrine_UnitOfWork_TestCase());
// Utility components
$test->addTestCase(new Doctrine_Hook_TestCase());
$test->addTestCase(new Doctrine_PessimisticLocking_TestCase());
$test->addTestCase(new Doctrine_Validator_TestCase());
$test->addTestCase(new Doctrine_RawSql_TestCase());
$test->addTestCase(new Doctrine_View_TestCase());
$test->addTestCase(new Doctrine_ConnectionTestCase());
// Db component
$test->addTestCase(new Doctrine_Db_TestCase());
$test->addTestCase(new Doctrine_Db_Profiler_TestCase());
// Record
$test->addTestCase(new Doctrine_Record_TestCase());
$test->addTestCase(new Doctrine_Relation_TestCase());
$test->addTestCase(new Doctrine_Record_State_TestCase());
//$test->addTestCase(new Doctrine_Record_Filter_TestCase());
//$test->addTestCase(new Doctrine_Import_TestCase());
$test->addTestCase(new Doctrine_SchemaTestCase());
$test->addTestCase(new Doctrine_EventListenerTestCase());
$test->addTestCase(new Doctrine_Connection_Transaction_TestCase());
$test->addTestCase(new Doctrine_AccessTestCase());
$test->addTestCase(new Doctrine_ManagerTestCase());
$test->addTestCase(new Doctrine_BatchIteratorTestCase());
//$test->addTestCase(new Doctrine_Collection_Offset_TestCase());
$test->addTestCase(new Doctrine_ViewTestCase());
$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_DataDict_Sqlite_TestCase());
// Eventlisteners
$test->addTestCase(new Doctrine_EventListener_TestCase());
$test->addTestCase(new Doctrine_EventListener_Chain_TestCase());
$test->addTestCase(new Doctrine_RelationAccessTestCase());
// Old test cases (should be removed)
$test->addTestCase(new Doctrine_SchemaTestCase());
$test->addTestCase(new Doctrine_BatchIterator_TestCase());
$test->addTestCase(new Doctrine_CustomPrimaryKey_TestCase());
$test->addTestCase(new Doctrine_CustomResultSetOrderTestCase());
$test->addTestCase(new Doctrine_Filter_TestCase());
//$test->addTestCase(new Doctrine_Collection_Offset_TestCase());
//$test->addTestCase(new Doctrine_Record_Filter_TestCase());
$test->addTestCase(new Doctrine_EnumTestCase());
// Query tests
$test->addTestCase(new Doctrine_Query_MultiJoin_TestCase());
$test->addTestCase(new Doctrine_Query_ReferenceModel_TestCase());
$test->addTestCase(new Doctrine_Query_Condition_TestCase());
......@@ -253,8 +175,10 @@ $test->addTestCase(new Doctrine_Query_Update_TestCase());
$test->addTestCase(new Doctrine_Query_AggregateValue_TestCase());
$test->addTestCase(new Doctrine_Query_Select_TestCase());
$test->addTestCase(new Doctrine_Hook_TestCase());
// Cache tests
//$test->addTestCase(new Doctrine_Cache_Query_SqliteTestCase());
//$test->addTestCase(new Doctrine_Cache_FileTestCase());
//$test->addTestCase(new Doctrine_Cache_SqliteTestCase());
......
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