1
0
mirror of synced 2024-12-13 14:56:01 +03:00

Migrating test cases to be PHP 5.2 compliant

This commit is contained in:
zYne 2007-02-15 22:21:10 +00:00
parent bb1cf022a3
commit 097adf5142
5 changed files with 61 additions and 5 deletions

View File

@ -130,7 +130,7 @@ class Doctrine_Connection_TestCase extends Doctrine_UnitTestCase {
$this->conn->exec('DROP TABLE entity'); $this->conn->exec('DROP TABLE entity');
} }
public function testGetManager() { public function testGetManager() {
$this->assertEqual($this->connection->getManager(),$this->manager); $this->assertTrue($this->connection->getManager() === $this->manager);
} }
public function testDelete() { public function testDelete() {
$user = $this->connection->create('User'); $user = $this->connection->create('User');

View File

@ -259,6 +259,31 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mysql_index_test_record (id BIGINT AUTO_INCREMENT, name TEXT, code INT, content TEXT, FULLTEXT INDEX content_idx (content), UNIQUE INDEX namecode_idx (name, code), PRIMARY KEY(id)) ENGINE = MYISAM'); $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mysql_index_test_record (id BIGINT AUTO_INCREMENT, name TEXT, code INT, content TEXT, FULLTEXT INDEX content_idx (content), UNIQUE INDEX namecode_idx (name, code), PRIMARY KEY(id)) ENGINE = MYISAM');
} }
public function testExportSupportsForeignKeys()
{
$r = new MysqlForeignKeyTest;
//print $this->adapter->pop();
//$this->assertEqual($this->adapter->pop());
}
}
class MysqlForeignKeyTest extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', null);
$this->hasColumn('code', 'integer', 4);
$this->hasColumn('content', 'string', 4000);
$this->hasColumn('parent_id', 'integer');
$this->foreignKey(array('local' => 'id',
'foreign' => 'parent_id',
'foreignTable' => 'mysql_foreign_key_test',
'onDelete' => 'CASCADE')
);
$this->option('type', 'INNODB');
}
} }
class MysqlIndexTestRecord extends Doctrine_Record class MysqlIndexTestRecord extends Doctrine_Record
{ {
@ -283,7 +308,7 @@ class MysqlTestRecord extends Doctrine_Record
$this->hasColumn('name', 'string', null, 'primary'); $this->hasColumn('name', 'string', null, 'primary');
$this->hasColumn('code', 'integer', null, 'primary'); $this->hasColumn('code', 'integer', null, 'primary');
$this->option('engine', 'INNODB'); $this->option('type', 'INNODB');
} }
} }
?> ?>

View File

@ -1,7 +1,36 @@
<?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>.
*/
/**
* Doctrine_Query_MultiJoin_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_Query_MultiJoin_TestCase extends Doctrine_UnitTestCase { class Doctrine_Query_MultiJoin_TestCase extends Doctrine_UnitTestCase {
public function testInitializeData() { public function testInitializeData() {
$query = new Doctrine_Query($this->connection); $query = new Doctrine_Query($this->connection);

View File

@ -10,6 +10,8 @@ class Doctrine_Query_ReferenceModel_TestCase extends Doctrine_UnitTestCase {
parent::prepareTables(); parent::prepareTables();
$this->connection->clear(); $this->connection->clear();
} }
public function prepareData()
{ }
public function testInitializeData() { public function testInitializeData() {
$query = new Doctrine_Query($this->connection); $query = new Doctrine_Query($this->connection);

View File

@ -70,7 +70,7 @@ class Doctrine_Relation_Access_TestCase extends Doctrine_UnitTestCase {
} }
public function prepareTables() { public function prepareTables() {
$this->tables = array("MyUser", $this->tables += array("MyUser",
"MyOneThing", "MyOneThing",
"MyUserOneThing", "MyUserOneThing",
"MyOtherThing", "MyOtherThing",