Commit 68147808 authored by jwage's avatar jwage

[2.0] Cleaning up tests and removing some unused files to remove any confusion

parent b8b8f85d
...@@ -12,11 +12,6 @@ if (!defined('PHPUnit_MAIN_METHOD')) { ...@@ -12,11 +12,6 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
require_once __DIR__ . '/TestInit.php'; require_once __DIR__ . '/TestInit.php';
// Suites
#require_once 'Common/AllTests.php';
#require_once 'Dbal/AllTests.php';
#require_once 'Orm/AllTests.php';
class AllTests class AllTests
{ {
public static function main() public static function main()
......
<?php <?php
class ClassLoaderTest_ClassA class ClassLoaderTest_ClassA
{ {
......
<?php <?php
class ClassLoaderTest_ClassB class ClassLoaderTest_ClassB
{ {
......
...@@ -8,9 +8,6 @@ if (!defined('PHPUnit_MAIN_METHOD')) { ...@@ -8,9 +8,6 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
require_once __DIR__ . '/../../TestInit.php'; require_once __DIR__ . '/../../TestInit.php';
// Tests
#require_once 'Common/Collections/CollectionTest.php';
class AllTests class AllTests
{ {
public static function main() public static function main()
......
...@@ -6,12 +6,6 @@ use Doctrine\Tests; ...@@ -6,12 +6,6 @@ use Doctrine\Tests;
require_once __DIR__ . '/../../TestInit.php'; require_once __DIR__ . '/../../TestInit.php';
/**
* Collection tests.
*
* @author robo
* @since 2.0
*/
class CollectionTest extends \Doctrine\Tests\DoctrineTestCase class CollectionTest extends \Doctrine\Tests\DoctrineTestCase
{ {
private $_coll; private $_coll;
......
<?php <?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace Doctrine\Tests\Common; namespace Doctrine\Tests\Common;
use Doctrine\Common\EventManager; use Doctrine\Common\EventManager;
use Doctrine\Common\EventArgs; use Doctrine\Common\EventArgs;
/**
* Description of EventManagerTest
*
* @author robo
*/
class EventManagerTest extends \Doctrine\Tests\DoctrineTestCase class EventManagerTest extends \Doctrine\Tests\DoctrineTestCase
{ {
/* Some pseudo events */ /* Some pseudo events */
...@@ -25,7 +16,8 @@ class EventManagerTest extends \Doctrine\Tests\DoctrineTestCase ...@@ -25,7 +16,8 @@ class EventManagerTest extends \Doctrine\Tests\DoctrineTestCase
private $_eventManager; private $_eventManager;
protected function setUp() { protected function setUp()
{
$this->_eventManager = new EventManager; $this->_eventManager = new EventManager;
$this->_preFooInvoked = false; $this->_preFooInvoked = false;
$this->_postFooInvoked = false; $this->_postFooInvoked = false;
...@@ -56,7 +48,6 @@ class EventManagerTest extends \Doctrine\Tests\DoctrineTestCase ...@@ -56,7 +48,6 @@ class EventManagerTest extends \Doctrine\Tests\DoctrineTestCase
$this->assertFalse($this->_postFooInvoked); $this->assertFalse($this->_postFooInvoked);
} }
/* Listener methods */ /* Listener methods */
public function preFoo(EventArgs $e) public function preFoo(EventArgs $e)
...@@ -69,4 +60,3 @@ class EventManagerTest extends \Doctrine\Tests\DoctrineTestCase ...@@ -69,4 +60,3 @@ class EventManagerTest extends \Doctrine\Tests\DoctrineTestCase
$this->_postFooInvoked = true; $this->_postFooInvoked = true;
} }
} }
\ No newline at end of file
...@@ -11,10 +11,6 @@ if (!defined('PHPUnit_MAIN_METHOD')) { ...@@ -11,10 +11,6 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
require_once __DIR__ . '/../TestInit.php'; require_once __DIR__ . '/../TestInit.php';
// Suites
#require_once 'Dbal/Component/AllTests.php';
#require_once 'Dbal/Ticket/AllTests.php';
class AllTests class AllTests
{ {
public static function main() public static function main()
...@@ -28,8 +24,6 @@ class AllTests ...@@ -28,8 +24,6 @@ class AllTests
$suite->addTestSuite('Doctrine\Tests\DBAL\Platforms\AbstractPlatformTest'); $suite->addTestSuite('Doctrine\Tests\DBAL\Platforms\AbstractPlatformTest');
$suite->addTest(Ticket\AllTests::suite());
return $suite; return $suite;
} }
} }
......
<?php
namespace Doctrine\Tests\DBAL\Ticket;
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'Ticket_AllTests::main');
}
require_once __DIR__ . '/../../TestInit.php';
// Tests
#require_once 'Dbal/Ticket/1Test.php';
class AllTests
{
public static function main()
{
\PHPUnit_TextUI_TestRunner::run(self::suite());
}
public static function suite()
{
$suite = new \Doctrine\Tests\DoctrineTestSuite('Doctrine Orm');
$suite->addTestSuite('Doctrine\Tests\DBAL\Ticket\Test1');
return $suite;
}
}
if (PHPUnit_MAIN_METHOD == 'Ticket_AllTests::main') {
AllTests::main();
}
\ No newline at end of file
<?php
namespace Doctrine\Tests\DBAL\Ticket;
require_once __DIR__ . '/../../TestInit.php';
class Test1 extends \Doctrine\Tests\DbalTestCase
{
public function testTest()
{
$this->assertEquals(0, 0);
}
}
\ No newline at end of file
...@@ -6,9 +6,9 @@ class ClassMetadataMock extends \Doctrine\ORM\Mapping\ClassMetadata ...@@ -6,9 +6,9 @@ class ClassMetadataMock extends \Doctrine\ORM\Mapping\ClassMetadata
{ {
/* Mock API */ /* Mock API */
public function setIdGeneratorType($type) { public function setIdGeneratorType($type)
{
$this->_generatorType = $type; $this->_generatorType = $type;
} }
} }
\ No newline at end of file
...@@ -8,7 +8,8 @@ class ConnectionMock extends \Doctrine\DBAL\Connection ...@@ -8,7 +8,8 @@ class ConnectionMock extends \Doctrine\DBAL\Connection
private $_lastInsertId = 0; private $_lastInsertId = 0;
private $_inserts = array(); private $_inserts = array();
public function __construct(array $params, $driver, $config = null, $eventManager = null) { public function __construct(array $params, $driver, $config = null, $eventManager = null)
{
parent::__construct($params, $driver, $config, $eventManager); parent::__construct($params, $driver, $config, $eventManager);
$this->_platformMock = new DatabasePlatformMock(); $this->_platformMock = new DatabasePlatformMock();
$this->_platform = $this->_platformMock; $this->_platform = $this->_platformMock;
...@@ -72,4 +73,3 @@ class ConnectionMock extends \Doctrine\DBAL\Connection ...@@ -72,4 +73,3 @@ class ConnectionMock extends \Doctrine\DBAL\Connection
$this->_lastInsertId = 0; $this->_lastInsertId = 0;
} }
} }
\ No newline at end of file
...@@ -19,7 +19,8 @@ class DatabasePlatformMock extends \Doctrine\DBAL\Platforms\AbstractPlatform ...@@ -19,7 +19,8 @@ class DatabasePlatformMock extends \Doctrine\DBAL\Platforms\AbstractPlatform
/** /**
* @override * @override
*/ */
public function prefersIdentityColumns() { public function prefersIdentityColumns()
{
return $this->_prefersIdentityColumns; return $this->_prefersIdentityColumns;
} }
...@@ -50,6 +51,4 @@ class DatabasePlatformMock extends \Doctrine\DBAL\Platforms\AbstractPlatform ...@@ -50,6 +51,4 @@ class DatabasePlatformMock extends \Doctrine\DBAL\Platforms\AbstractPlatform
{ {
$this->_prefersIdentityColumns = (bool)$bool; $this->_prefersIdentityColumns = (bool)$bool;
} }
} }
\ No newline at end of file
...@@ -15,4 +15,3 @@ class DriverConnectionMock implements \Doctrine\DBAL\Driver\Connection ...@@ -15,4 +15,3 @@ class DriverConnectionMock implements \Doctrine\DBAL\Driver\Connection
public function errorCode() {} public function errorCode() {}
public function errorInfo() {} public function errorInfo() {}
} }
...@@ -49,4 +49,3 @@ class DriverMock implements \Doctrine\DBAL\Driver ...@@ -49,4 +49,3 @@ class DriverMock implements \Doctrine\DBAL\Driver
$this->_platformMock = $platform; $this->_platformMock = $platform;
} }
} }
...@@ -87,4 +87,3 @@ class EntityManagerMock extends \Doctrine\ORM\EntityManager ...@@ -87,4 +87,3 @@ class EntityManagerMock extends \Doctrine\ORM\EntityManager
return parent::getIdGenerator($className); return parent::getIdGenerator($className);
} }
} }
...@@ -28,7 +28,8 @@ class EntityPersisterMock extends \Doctrine\ORM\Persisters\StandardEntityPersist ...@@ -28,7 +28,8 @@ class EntityPersisterMock extends \Doctrine\ORM\Persisters\StandardEntityPersist
return null; return null;
} }
public function setMockIdGeneratorType($genType) { public function setMockIdGeneratorType($genType)
{
$this->_mockIdGeneratorType = $genType; $this->_mockIdGeneratorType = $genType;
} }
...@@ -65,4 +66,3 @@ class EntityPersisterMock extends \Doctrine\ORM\Persisters\StandardEntityPersist ...@@ -65,4 +66,3 @@ class EntityPersisterMock extends \Doctrine\ORM\Persisters\StandardEntityPersist
$this->_deletes = array(); $this->_deletes = array();
} }
} }
\ No newline at end of file
...@@ -2,11 +2,6 @@ ...@@ -2,11 +2,6 @@
namespace Doctrine\Tests\Mocks; namespace Doctrine\Tests\Mocks;
/**
* Description of Doctrine_IdentityIdGeneratorMock
*
* @author robo
*/
class IdentityIdGeneratorMock extends \Doctrine\ORM\Id\IdentityGenerator class IdentityIdGeneratorMock extends \Doctrine\ORM\Id\IdentityGenerator
{ {
private $_mockPostInsertId; private $_mockPostInsertId;
...@@ -15,4 +10,3 @@ class IdentityIdGeneratorMock extends \Doctrine\ORM\Id\IdentityGenerator ...@@ -15,4 +10,3 @@ class IdentityIdGeneratorMock extends \Doctrine\ORM\Id\IdentityGenerator
$this->_mockPostInsertId = $id; $this->_mockPostInsertId = $id;
} }
} }
\ No newline at end of file
<?php <?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace Doctrine\Tests\Mocks; namespace Doctrine\Tests\Mocks;
/**
* Description of Doctrine_MetadataDriverMock
*
* @author robo
*/
class MetadataDriverMock class MetadataDriverMock
{ {
public function loadMetadataForClass($className, \Doctrine\ORM\Mapping\ClassMetadata $metadata) { public function loadMetadataForClass($className, \Doctrine\ORM\Mapping\ClassMetadata $metadata)
{
return; return;
} }
public function isTransient($className) {
public function isTransient($className)
{
return false; return false;
} }
} }
\ No newline at end of file
<?php <?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace Doctrine\Tests\Mocks; namespace Doctrine\Tests\Mocks;
/**
* Description of SchemaManagerMock
*
* @author robo
*/
class SchemaManagerMock extends \Doctrine\DBAL\Schema\AbstractSchemaManager class SchemaManagerMock extends \Doctrine\DBAL\Schema\AbstractSchemaManager
{ {
public function __construct(\Doctrine\DBAL\Connection $conn) { public function __construct(\Doctrine\DBAL\Connection $conn)
{
parent::__construct($conn); parent::__construct($conn);
} }
} }
\ No newline at end of file
...@@ -2,12 +2,8 @@ ...@@ -2,12 +2,8 @@
namespace Doctrine\Tests\Mocks; namespace Doctrine\Tests\Mocks;
/** class UnitOfWorkMock extends \Doctrine\ORM\UnitOfWork
* Description of Doctrine_UnitOfWorkMock {
*
* @author robo
*/
class UnitOfWorkMock extends \Doctrine\ORM\UnitOfWork {
private $_mockDataChangeSets = array(); private $_mockDataChangeSets = array();
private $_persisterMock; private $_persisterMock;
...@@ -24,7 +20,8 @@ class UnitOfWorkMock extends \Doctrine\ORM\UnitOfWork { ...@@ -24,7 +20,8 @@ class UnitOfWorkMock extends \Doctrine\ORM\UnitOfWork {
* @param <type> $entity * @param <type> $entity
* @override * @override
*/ */
public function getEntityChangeSet($entity) { public function getEntityChangeSet($entity)
{
$oid = spl_object_hash($entity); $oid = spl_object_hash($entity);
return isset($this->_mockDataChangeSets[$oid]) ? return isset($this->_mockDataChangeSets[$oid]) ?
$this->_mockDataChangeSets[$oid] : parent::getEntityChangeSet($entity); $this->_mockDataChangeSets[$oid] : parent::getEntityChangeSet($entity);
...@@ -44,7 +41,8 @@ class UnitOfWorkMock extends \Doctrine\ORM\UnitOfWork { ...@@ -44,7 +41,8 @@ class UnitOfWorkMock extends \Doctrine\ORM\UnitOfWork {
$this->_persisterMock[$entityName] = $persister; $this->_persisterMock[$entityName] = $persister;
} }
public function setDataChangeSet($entity, array $mockChangeSet) { public function setDataChangeSet($entity, array $mockChangeSet)
{
$this->_mockDataChangeSets[spl_object_hash($entity)] = $mockChangeSet; $this->_mockDataChangeSets[spl_object_hash($entity)] = $mockChangeSet;
} }
...@@ -58,4 +56,3 @@ class UnitOfWorkMock extends \Doctrine\ORM\UnitOfWork { ...@@ -58,4 +56,3 @@ class UnitOfWorkMock extends \Doctrine\ORM\UnitOfWork {
$this->_originalEntityData[spl_object_hash($entity)] = $originalData; $this->_originalEntityData[spl_object_hash($entity)] = $originalData;
} }
} }
\ No newline at end of file
<?php <?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace Doctrine\Tests\Models\CMS; namespace Doctrine\Tests\Models\CMS;
/** /**
* Description of CmsAddress * CmsAddress
* *
* @author robo * @author Roman S. Borschel
* @DoctrineEntity * @DoctrineEntity
* @DoctrineTable(name="cms_addresses") * @DoctrineTable(name="cms_addresses")
*/ */
...@@ -21,22 +17,25 @@ class CmsAddress ...@@ -21,22 +17,25 @@ class CmsAddress
* @DoctrineIdGenerator("auto") * @DoctrineIdGenerator("auto")
*/ */
public $id; public $id;
/** /**
* @DoctrineColumn(type="varchar", length=50) * @DoctrineColumn(type="varchar", length=50)
*/ */
public $country; public $country;
/** /**
* @DoctrineColumn(type="varchar", length=50) * @DoctrineColumn(type="varchar", length=50)
*/ */
public $zip; public $zip;
/** /**
* @DoctrineColumn(type="varchar", length=50) * @DoctrineColumn(type="varchar", length=50)
*/ */
public $city; public $city;
/** /**
* @DoctrineOneToOne(targetEntity="CmsUser") * @DoctrineOneToOne(targetEntity="CmsUser")
* @DoctrineJoinColumn(name="user_id", referencedColumnName="id") * @DoctrineJoinColumn(name="user_id", referencedColumnName="id")
*/ */
public $user; public $user;
} }
\ No newline at end of file
<?php <?php
namespace Doctrine\Tests\Models\Company;
/**
* @DoctrineEntity
* @DoctrineTable(name="company_employee")
* @DoctrineInheritanceType("joined")
* @DoctrineDiscriminatorColumn(name="dtype", type="varchar", length=20)
* @DoctrineDiscriminatorMap({
"emp" = "Doctrine\Tests\Models\Company\CompanyEmployee",
"man" = "Doctrine\Tests\Models\Company\CompanyManager"})
* @DoctrineSubclasses({"Doctrine\Tests\Models\Company\CompanyManager"})
*/
class CompanyEmployee class CompanyEmployee
{ {
#protected $id; /**
#protected $salary; * @DoctrineId
#protected $department; * @DoctrineColumn(type="integer")
* @DoctrineIdGenerator("auto")
public static function initMetadata($mapping) */
{ public $id;
// inheritance mapping
$mapping->setInheritanceType('joined', array(
'discriminatorColumn' => 'dtype',
'discriminatorMap' => array(
'emp' => 'CompanyEmployee',
'man' => 'CompanyManager')
));
// register subclasses
$mapping->setSubclasses(array('CompanyManager'));
$mapping->mapField(array( /**
'fieldName' => 'id', * @DoctrineColumn(type="double")
'type' => 'integer', */
'length' => 4, public $salary;
'id' => true,
'idGenerator' => 'auto'
));
$mapping->mapField(array(
'fieldName' => 'salary',
'type' => 'double'
));
//TODO: make department an entity
$mapping->mapField(array(
'fieldName' => 'department',
'type' => 'string'
));
}
/**
* @DoctrineColumn(type="varchar", length=255)
*/
public $department;
} }
\ No newline at end of file
?>
\ No newline at end of file
<?php <?php
namespace Doctrine\Tests\Models\Company;
/**
* @DoctrineEntity
*/
class CompanyManager extends CompanyEmployee class CompanyManager extends CompanyEmployee
{ {
public static function initMetadata($mapping) /*
{ * @DoctrineColumn(type="varchar", length="255")
$mapping->mapColumn(array( */
'fieldName' => 'title', public $title;
'type' => 'string'
));
}
} }
\ No newline at end of file
?>
\ No newline at end of file
<?php
require_once 'lib/DoctrineTestInit.php';
class Orm_Associations_CascadeTest extends Doctrine_OrmTestCase
{
protected function setUp() {
;
}
protected function tearDown() {
;
}
public function testDeleteCascade()
{
$container = array();
$cascade = new DeleteCascade();
$cascade->cascade($entity, $container);
}
}
abstract class Cascade
{
public function cascade(Doctrine_Entity $record, array &$container)
{
if ($this->shouldCascadeTo($record)) {
$container[$record->getOid()] = $record;
}
foreach ($record->getTable()->getRelations() as $relation) {
if ($this->doCascade($relation)) {
$this->prepareCascade($record, $relation);
$relatedObjects = $record->get($relation->getAlias());
if ($relatedObjects instanceof Doctrine_Record && $this->shouldCascadeTo($relatedObjects)
&& ! isset($container[$relatedObjects->getOid()])) {
$this->cascade($relatedObjects, $container);
} else if ($relatedObjects instanceof Doctrine_Collection && count($relatedObjects) > 0) {
foreach ($relatedObjects as $object) {
if ( ! isset($container[$object->getOid()])) {
$this->cascade($object, $container);
}
}
}
}
}
}
}
class DeleteCascade extends Cascade
{
public function doCascade($relation)
{
return $relation->isCascadeDelete();
}
public function prepareCascade($record, $relation)
{
$fieldName = $relation->getAlias();
// if it's a xToOne relation and the related object is already loaded
// we don't need to refresh, else we need to.
if ( ! ($relation->getType() == Doctrine_Relation::ONE && isset($record->$fieldName))) {
$record->refreshRelated($relation->getAlias());
}
}
public function shouldCascadeTo(Doctrine_Entity $entity)
{
//TODO: also ignore removed Entities. incorporate that in exists() with a new
// state? (DELETED?)
return ! $entity->exists();
}
}
\ No newline at end of file
...@@ -24,7 +24,6 @@ class OneToOneMappingTest extends \Doctrine\Tests\OrmTestCase ...@@ -24,7 +24,6 @@ class OneToOneMappingTest extends \Doctrine\Tests\OrmTestCase
$this->assertEquals('address', $oneToOneMapping->getSourceFieldName()); $this->assertEquals('address', $oneToOneMapping->getSourceFieldName());
$this->assertTrue($oneToOneMapping->isOwningSide()); $this->assertTrue($oneToOneMapping->isOwningSide());
$inverseSideMapping = array( $inverseSideMapping = array(
'fieldName' => 'person', 'fieldName' => 'person',
'sourceEntity' => 'Address', 'sourceEntity' => 'Address',
...@@ -37,7 +36,5 @@ class OneToOneMappingTest extends \Doctrine\Tests\OrmTestCase ...@@ -37,7 +36,5 @@ class OneToOneMappingTest extends \Doctrine\Tests\OrmTestCase
$this->assertEquals('Address', $oneToOneMapping->getSourceEntityName()); $this->assertEquals('Address', $oneToOneMapping->getSourceEntityName());
$this->assertEquals('Person', $oneToOneMapping->getTargetEntityName()); $this->assertEquals('Person', $oneToOneMapping->getTargetEntityName());
$this->assertTrue($oneToOneMapping->isInverseSide()); $this->assertTrue($oneToOneMapping->isInverseSide());
} }
} }
\ No newline at end of file
...@@ -48,6 +48,5 @@ class CommitOrderCalculatorTest extends \Doctrine\Tests\OrmTestCase ...@@ -48,6 +48,5 @@ class CommitOrderCalculatorTest extends \Doctrine\Tests\OrmTestCase
// There is only 1 valid ordering for this constellation // There is only 1 valid ordering for this constellation
$correctOrder = array("node5", "node1", "node2", "node3", "node4"); $correctOrder = array("node5", "node1", "node2", "node3", "node4");
$this->assertSame($correctOrder, $sorted); $this->assertSame($correctOrder, $sorted);
} }
} }
\ No newline at end of file
<?php
/* CURRENTLY NOT USED */
require_once 'lib/DoctrineTestInit.php';
class Orm_Entity_AccessorTest extends Doctrine_OrmTestCase
{
public function testGetterSetterOverride()
{
$entity1 = new CustomAccessorMutatorTestEntity();
$entity1->username = 'romanb';
$this->assertEquals('romanb?!', $entity1->username);
$entity2 = new MagicAccessorMutatorTestEntity();
$entity2->username = 'romanb';
$this->assertEquals('romanb?!', $entity1->username);
}
}
/* Local test classes */
class CustomAccessorMutatorTestEntity extends Doctrine_Common_VirtualPropertyObject
{
static function construct() {
Doctrine_Common_VirtualPropertySystem::register(__CLASS__, 'id', 'int');
Doctrine_Common_VirtualPropertySystem::register(__CLASS__,
'username', 'string', 'getUsernameCustom', 'setUsernameCustom');
}
public static function initMetadata($mapping)
{
$mapping->mapField(array(
'fieldName' => 'id',
'type' => 'integer',
'length' => 4,
'id' => true
));
$mapping->mapField(array(
'fieldName' => 'username',
'type' => 'string',
'length' => 50
));
}
public function getUsernameCustom()
{
return $this->_get('username') . "!";
}
public function setUsernameCustom($username)
{
$this->_set('username', $username . "?");
}
}
class MagicAccessorMutatorTestEntity extends Doctrine_Common_VirtualPropertyObject
{
static function construct() {
Doctrine_Common_VirtualPropertySystem::register(__CLASS__, 'id', 'int');
Doctrine_Common_VirtualPropertySystem::register(__CLASS__, 'username', 'string');
}
public static function initMetadata($mapping)
{
$mapping->mapField(array(
'fieldName' => 'id',
'type' => 'integer',
'length' => 4,
'id' => true
));
$mapping->mapField(array(
'fieldName' => 'username',
'type' => 'string',
'length' => 50
));
}
public function getUsername()
{
return $this->_get('username') . "!";
}
public function setUsername($username)
{
$this->_set('username', $username . "?");
}
}
\ No newline at end of file
...@@ -20,7 +20,6 @@ class AllTests ...@@ -20,7 +20,6 @@ class AllTests
{ {
$suite = new \Doctrine\Tests\DoctrineTestSuite('Doctrine Orm Entity Tests'); $suite = new \Doctrine\Tests\DoctrineTestSuite('Doctrine Orm Entity Tests');
//$suite->addTestSuite('Orm_Entity_AccessorTest');
$suite->addTestSuite('Doctrine\Tests\ORM\Entity\ConstructorTest'); $suite->addTestSuite('Doctrine\Tests\ORM\Entity\ConstructorTest');
return $suite; return $suite;
......
...@@ -4,14 +4,12 @@ namespace Doctrine\Tests\ORM; ...@@ -4,14 +4,12 @@ namespace Doctrine\Tests\ORM;
require_once __DIR__ . '/../TestInit.php'; require_once __DIR__ . '/../TestInit.php';
/**
* EntityManager tests.
*/
class EntityManagerTest extends \Doctrine\Tests\OrmTestCase class EntityManagerTest extends \Doctrine\Tests\OrmTestCase
{ {
private $_em; private $_em;
function setUp() { function setUp()
{
parent::setUp(); parent::setUp();
$this->_em = $this->_getTestEntityManager(); $this->_em = $this->_getTestEntityManager();
} }
......
...@@ -12,9 +12,6 @@ use Doctrine\Tests\Models\Forum\ForumAvatar; ...@@ -12,9 +12,6 @@ use Doctrine\Tests\Models\Forum\ForumAvatar;
require_once __DIR__ . '/../TestInit.php'; require_once __DIR__ . '/../TestInit.php';
/**
* EntityPersister tests.
*/
class EntityPersisterTest extends \Doctrine\Tests\OrmTestCase class EntityPersisterTest extends \Doctrine\Tests\OrmTestCase
{ {
private $_connMock; private $_connMock;
...@@ -22,7 +19,8 @@ class EntityPersisterTest extends \Doctrine\Tests\OrmTestCase ...@@ -22,7 +19,8 @@ class EntityPersisterTest extends \Doctrine\Tests\OrmTestCase
private $_idGenMock; private $_idGenMock;
private $_uowMock; private $_uowMock;
protected function setUp() { protected function setUp()
{
parent::setUp(); parent::setUp();
$this->_connMock = new ConnectionMock(array(), new \Doctrine\Tests\Mocks\DriverMock()); $this->_connMock = new ConnectionMock(array(), new \Doctrine\Tests\Mocks\DriverMock());
$this->_emMock = EntityManagerMock::create($this->_connMock); $this->_emMock = EntityManagerMock::create($this->_connMock);
...@@ -32,7 +30,8 @@ class EntityPersisterTest extends \Doctrine\Tests\OrmTestCase ...@@ -32,7 +30,8 @@ class EntityPersisterTest extends \Doctrine\Tests\OrmTestCase
$this->_emMock->setIdGenerator('Doctrine\Tests\Models\Forum\ForumUser', $this->_idGenMock); $this->_emMock->setIdGenerator('Doctrine\Tests\Models\Forum\ForumUser', $this->_idGenMock);
} }
public function testSimpleInsert() { public function testSimpleInsert()
{
$userPersister = new \Doctrine\ORM\Persisters\StandardEntityPersister( $userPersister = new \Doctrine\ORM\Persisters\StandardEntityPersister(
$this->_emMock, $this->_emMock->getClassMetadata("Doctrine\Tests\Models\Forum\ForumUser")); $this->_emMock, $this->_emMock->getClassMetadata("Doctrine\Tests\Models\Forum\ForumUser"));
$avatarPersister = new \Doctrine\ORM\Persisters\StandardEntityPersister( $avatarPersister = new \Doctrine\ORM\Persisters\StandardEntityPersister(
...@@ -46,7 +45,6 @@ class EntityPersisterTest extends \Doctrine\Tests\OrmTestCase ...@@ -46,7 +45,6 @@ class EntityPersisterTest extends \Doctrine\Tests\OrmTestCase
'username' => array('', 'romanb'), 'username' => array('', 'romanb'),
'avatar' => array('', $user->avatar))); 'avatar' => array('', $user->avatar)));
//insert //insert
$avatarPersister->insert($user->avatar); $avatarPersister->insert($user->avatar);
$inserts = $this->_connMock->getInserts(); $inserts = $this->_connMock->getInserts();
...@@ -76,5 +74,4 @@ class EntityPersisterTest extends \Doctrine\Tests\OrmTestCase ...@@ -76,5 +74,4 @@ class EntityPersisterTest extends \Doctrine\Tests\OrmTestCase
$this->assertTrue(isset($inserts['forum_users'][0]['dtype'])); $this->assertTrue(isset($inserts['forum_users'][0]['dtype']));
$this->assertEquals('user', $inserts['forum_users'][0]['dtype']); $this->assertEquals('user', $inserts['forum_users'][0]['dtype']);
} }
} }
\ No newline at end of file
...@@ -10,14 +10,6 @@ if (!defined('PHPUnit_MAIN_METHOD')) { ...@@ -10,14 +10,6 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
require_once __DIR__ . '/../../TestInit.php'; require_once __DIR__ . '/../../TestInit.php';
#require_once 'IdentifierRecognitionTest.php';
/*require_once 'ScannerTest.php';
require_once 'DqlGenerationTest.php';
require_once 'DeleteSqlGenerationTest.php';
require_once 'UpdateSqlGenerationTest.php';
require_once 'SelectSqlGenerationTest.php';
require_once 'LanguageRecognitionTest.php';*/
class AllTests class AllTests
{ {
public static function main() public static function main()
......
<?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.doctrine-project.org>.
*/
namespace Doctrine\Tests\ORM\Export; namespace Doctrine\Tests\ORM\Export;
...@@ -25,37 +6,24 @@ use Doctrine\ORM\Export\ClassExporter; ...@@ -25,37 +6,24 @@ use Doctrine\ORM\Export\ClassExporter;
require_once __DIR__ . '/../../TestInit.php'; require_once __DIR__ . '/../../TestInit.php';
/**
* Test case for testing the ddl class exporter
*
* @package Doctrine
* @subpackage Query
* @author Jonathan H. Wage <jonwage@gmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.doctrine-project.org
* @since 2.0
* @version $Revision$
*/
class ClassExporterTest extends \Doctrine\Tests\OrmTestCase class ClassExporterTest extends \Doctrine\Tests\OrmTestCase
{ {
public function testTest() public function testGetExportClassesSql()
{ {
// DDL is platform dependant. We can inject the platform to test into the driver mock.
$driver = new \Doctrine\Tests\Mocks\DriverMock; $driver = new \Doctrine\Tests\Mocks\DriverMock;
$conn = new \Doctrine\Tests\Mocks\ConnectionMock(array(), $driver); $conn = new \Doctrine\Tests\Mocks\ConnectionMock(array(), $driver);
//$conn->setDatabasePlatform(new \Doctrine\DBAL\Platforms\SqlitePlatform());
$conn->setDatabasePlatform(new \Doctrine\DBAL\Platforms\MySqlPlatform()); $conn->setDatabasePlatform(new \Doctrine\DBAL\Platforms\MySqlPlatform());
$em = $this->_getTestEntityManager($conn); $em = $this->_getTestEntityManager($conn);
$classes = array( $classes = array(
$em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress'),
$em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsUser'), $em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsUser'),
$em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsPhonenumber') $em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsPhonenumber'),
); );
$exporter = new ClassExporter($em); $exporter = new ClassExporter($em);
$sql = $exporter->getExportClassesSql($classes); $sql = $exporter->getExportClassesSql($classes);
print_r($sql); $this->assertEquals(count($sql), 8);
} }
} }
\ No newline at end of file
...@@ -21,8 +21,6 @@ class AllTests ...@@ -21,8 +21,6 @@ class AllTests
$suite->addTestSuite('Doctrine\Tests\ORM\Functional\BasicCRUDTest'); $suite->addTestSuite('Doctrine\Tests\ORM\Functional\BasicCRUDTest');
//$suite->addTest(Orm_Functional_Ticket_AllTests::suite());
return $suite; return $suite;
} }
} }
......
...@@ -10,14 +10,10 @@ use Doctrine\Tests\Models\CMS\CmsGroup; ...@@ -10,14 +10,10 @@ use Doctrine\Tests\Models\CMS\CmsGroup;
require_once __DIR__ . '/../../TestInit.php'; require_once __DIR__ . '/../../TestInit.php';
/** class BasicCRUDTest extends \Doctrine\Tests\OrmFunctionalTestCase
* Description of BasicCRUDTest {
* public function testBasicUnitsOfWorkWithOneToManyAssociation()
* @author robo {
*/
class BasicCRUDTest extends \Doctrine\Tests\OrmFunctionalTestCase {
public function testBasicUnitsOfWorkWithOneToManyAssociation() {
$em = $this->_em; $em = $this->_em;
$exporter = new ClassExporter($this->_em); $exporter = new ClassExporter($this->_em);
...@@ -73,7 +69,8 @@ class BasicCRUDTest extends \Doctrine\Tests\OrmFunctionalTestCase { ...@@ -73,7 +69,8 @@ class BasicCRUDTest extends \Doctrine\Tests\OrmFunctionalTestCase {
$this->assertFalse($em->getUnitOfWork()->isRegisteredRemoved($ph2)); $this->assertFalse($em->getUnitOfWork()->isRegisteredRemoved($ph2));
} }
public function testOneToManyAssociationModification() { public function testOneToManyAssociationModification()
{
$user = new CmsUser; $user = new CmsUser;
$user->name = 'Roman'; $user->name = 'Roman';
$user->username = 'romanb'; $user->username = 'romanb';
...@@ -192,4 +189,3 @@ class BasicCRUDTest extends \Doctrine\Tests\OrmFunctionalTestCase { ...@@ -192,4 +189,3 @@ class BasicCRUDTest extends \Doctrine\Tests\OrmFunctionalTestCase {
$this->assertEquals(0, $count); $this->assertEquals(0, $count);
} }
} }
\ No newline at end of file
<?php
require_once 'lib/DoctrineTestInit.php';
class Orm_Functional_Ticket_1Test extends Doctrine_OrmTestCase
{
public function testTest()
{
$this->assertEquals(0, 0);
}
}
\ No newline at end of file
<?php
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'Orm_Functional_Ticket_AllTests::main');
}
require_once 'lib/DoctrineTestInit.php';
// Tests
require_once 'Orm/Functional/Ticket/1Test.php';
class Orm_Functional_Ticket_AllTests
{
public static function main()
{
PHPUnit_TextUI_TestRunner::run(self::suite());
}
public static function suite()
{
$suite = new Doctrine_TestSuite('Doctrine Orm');
$suite->addTestSuite('Orm_Functional_Ticket_1Test');
return $suite;
}
}
if (PHPUnit_MAIN_METHOD == 'Orm_Functional_Ticket_AllTests::main') {
Ticket_AllTests::main();
}
\ No newline at end of file
...@@ -6,11 +6,6 @@ use Doctrine\Tests\Mocks\HydratorMockStatement; ...@@ -6,11 +6,6 @@ use Doctrine\Tests\Mocks\HydratorMockStatement;
require_once __DIR__ . '/../../TestInit.php'; require_once __DIR__ . '/../../TestInit.php';
/**
* Description of ArrayHydratorTest
*
* @author robo
*/
class ArrayHydratorTest extends HydrationTest class ArrayHydratorTest extends HydrationTest
{ {
/** /**
...@@ -663,7 +658,8 @@ class ArrayHydratorTest extends HydrationTest ...@@ -663,7 +658,8 @@ class ArrayHydratorTest extends HydrationTest
$this->assertEquals(1, count($result[1]['boards'])); $this->assertEquals(1, count($result[1]['boards']));
} }
public function testResultIteration() { public function testResultIteration()
{
// Faked query components // Faked query components
$queryComponents = array( $queryComponents = array(
'u' => array( 'u' => array(
...@@ -713,4 +709,3 @@ class ArrayHydratorTest extends HydrationTest ...@@ -713,4 +709,3 @@ class ArrayHydratorTest extends HydrationTest
} }
} }
} }
\ No newline at end of file
...@@ -4,11 +4,6 @@ namespace Doctrine\Tests\ORM\Hydration; ...@@ -4,11 +4,6 @@ namespace Doctrine\Tests\ORM\Hydration;
require_once __DIR__ . '/../../TestInit.php'; require_once __DIR__ . '/../../TestInit.php';
/**
* Description of HydrationTest
*
* @author robo
*/
class HydrationTest extends \Doctrine\Tests\OrmTestCase class HydrationTest extends \Doctrine\Tests\OrmTestCase
{ {
protected $_em; protected $_em;
...@@ -29,4 +24,3 @@ class HydrationTest extends \Doctrine\Tests\OrmTestCase ...@@ -29,4 +24,3 @@ class HydrationTest extends \Doctrine\Tests\OrmTestCase
return $parserResult; return $parserResult;
} }
} }
\ No newline at end of file
...@@ -6,11 +6,6 @@ use Doctrine\Tests\Mocks\HydratorMockStatement; ...@@ -6,11 +6,6 @@ use Doctrine\Tests\Mocks\HydratorMockStatement;
require_once __DIR__ . '/../../TestInit.php'; require_once __DIR__ . '/../../TestInit.php';
/**
* Description of ObjectHydratorTest
*
* @author robo
*/
class ObjectHydratorTest extends HydrationTest class ObjectHydratorTest extends HydrationTest
{ {
/** /**
...@@ -669,7 +664,8 @@ class ObjectHydratorTest extends HydrationTest ...@@ -669,7 +664,8 @@ class ObjectHydratorTest extends HydrationTest
} }
public function testResultIteration() { public function testResultIteration()
{
// Faked query components // Faked query components
$queryComponents = array( $queryComponents = array(
'u' => array( 'u' => array(
...@@ -728,7 +724,7 @@ class ObjectHydratorTest extends HydrationTest ...@@ -728,7 +724,7 @@ class ObjectHydratorTest extends HydrationTest
* *
* @dataProvider hydrationModeProvider * @dataProvider hydrationModeProvider
*/ */
/*public function testNewHydrationMixedQueryFetchJoinPerformance() public function testNewHydrationMixedQueryFetchJoinPerformance()
{ {
// Faked query components // Faked query components
$queryComponents = array( $queryComponents = array(
...@@ -740,7 +736,7 @@ class ObjectHydratorTest extends HydrationTest ...@@ -740,7 +736,7 @@ class ObjectHydratorTest extends HydrationTest
'agg' => array('0' => 'nameUpper') 'agg' => array('0' => 'nameUpper')
), ),
'p' => array( 'p' => array(
'metadata' => $this->_em->getClassMetadata('CmsPhonenumber'), 'metadata' => $this->_em->getClassMetadata('\Doctrine\Tests\Models\CMS\CmsPhonenumber'),
'parent' => 'u', 'parent' => 'u',
'relation' => $this->_em->getClassMetadata('\Doctrine\Tests\Models\CMS\CmsUser')->getAssociationMapping('phonenumbers'), 'relation' => $this->_em->getClassMetadata('\Doctrine\Tests\Models\CMS\CmsUser')->getAssociationMapping('phonenumbers'),
'map' => null 'map' => null
...@@ -775,7 +771,8 @@ class ObjectHydratorTest extends HydrationTest ...@@ -775,7 +771,8 @@ class ObjectHydratorTest extends HydrationTest
'p__phonenumber' => '91' 'p__phonenumber' => '91'
) )
); );
for ($i=4; $i<300; $i++) {
for ($i = 4; $i < 300; $i++) {
$resultSet[] = array( $resultSet[] = array(
'u__id' => $i, 'u__id' => $i,
'u__status' => 'developer', 'u__status' => 'developer',
...@@ -784,12 +781,10 @@ class ObjectHydratorTest extends HydrationTest ...@@ -784,12 +781,10 @@ class ObjectHydratorTest extends HydrationTest
); );
} }
$stmt = new Doctrine_HydratorMockStatement($resultSet); $stmt = new HydratorMockStatement($resultSet);
$hydrator = new Doctrine_ORM_Internal_Hydration_ObjectHydrator($this->_em); $hydrator = new \Doctrine\ORM\Internal\Hydration\ObjectHydrator($this->_em);
$result = $hydrator->hydrateAll($stmt, $this->_createParserResult( $result = $hydrator->hydrateAll($stmt, $this->_createParserResult(
$queryComponents, $tableAliasMap, true)); $queryComponents, $tableAliasMap, true));
}
}*/
} }
\ No newline at end of file
...@@ -6,11 +6,6 @@ use Doctrine\Tests\Mocks\HydratorMockStatement; ...@@ -6,11 +6,6 @@ use Doctrine\Tests\Mocks\HydratorMockStatement;
require_once __DIR__ . '/../../TestInit.php'; require_once __DIR__ . '/../../TestInit.php';
/**
* Description of ScalarHydratorTest
*
* @author robo
*/
class ScalarHydratorTest extends HydrationTest class ScalarHydratorTest extends HydrationTest
{ {
/** /**
...@@ -60,4 +55,3 @@ class ScalarHydratorTest extends HydrationTest ...@@ -60,4 +55,3 @@ class ScalarHydratorTest extends HydrationTest
$this->assertEquals(2, $result[1]['u_id']); $this->assertEquals(2, $result[1]['u_id']);
} }
} }
\ No newline at end of file
...@@ -6,11 +6,6 @@ use Doctrine\Tests\Mocks\HydratorMockStatement; ...@@ -6,11 +6,6 @@ use Doctrine\Tests\Mocks\HydratorMockStatement;
require_once __DIR__ . '/../../TestInit.php'; require_once __DIR__ . '/../../TestInit.php';
/**
* Description of SingleScalarHydratorTest
*
* @author robo
*/
class SingleScalarHydratorTest extends HydrationTest class SingleScalarHydratorTest extends HydrationTest
{ {
/** Result set provider for the HYDRATE_SINGLE_SCALAR tests */ /** Result set provider for the HYDRATE_SINGLE_SCALAR tests */
...@@ -91,7 +86,5 @@ class SingleScalarHydratorTest extends HydrationTest ...@@ -91,7 +86,5 @@ class SingleScalarHydratorTest extends HydrationTest
$this->fail(); $this->fail();
} catch (\Doctrine\ORM\Internal\Hydration\HydrationException $ex) {} } catch (\Doctrine\ORM\Internal\Hydration\HydrationException $ex) {}
} }
} }
} }
\ No newline at end of file
<?php <?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace Doctrine\Tests\ORM\Mapping; namespace Doctrine\Tests\ORM\Mapping;
...@@ -12,14 +8,11 @@ use Doctrine\ORM\Mapping\ClassMetadata; ...@@ -12,14 +8,11 @@ use Doctrine\ORM\Mapping\ClassMetadata;
require_once __DIR__ . '/../../TestInit.php'; require_once __DIR__ . '/../../TestInit.php';
/** class ClassMetadataFactoryTest extends \Doctrine\Tests\OrmTestCase
* Description of ClassMetadataFactoryTest {
*
* @author robo
*/
class ClassMetadataFactoryTest extends \Doctrine\Tests\OrmTestCase {
public function testGetMetadataForSingleClass() { public function testGetMetadataForSingleClass()
{
$mockPlatform = new DatabasePlatformMock(); $mockPlatform = new DatabasePlatformMock();
$mockDriver = new MetadataDriverMock(); $mockDriver = new MetadataDriverMock();
...@@ -52,7 +45,8 @@ class ClassMetadataFactoryTest extends \Doctrine\Tests\OrmTestCase { ...@@ -52,7 +45,8 @@ class ClassMetadataFactoryTest extends \Doctrine\Tests\OrmTestCase {
$this->assertEquals('table', $cm1->getIdGeneratorType()); $this->assertEquals('table', $cm1->getIdGeneratorType());
} }
public function testGetMetadataForClassInHierarchy() { public function testGetMetadataForClassInHierarchy()
{
$mockPlatform = new DatabasePlatformMock(); $mockPlatform = new DatabasePlatformMock();
$mockPlatform->setPrefersIdentityColumns(true); $mockPlatform->setPrefersIdentityColumns(true);
$mockDriver = new MetadataDriverMock(); $mockDriver = new MetadataDriverMock();
...@@ -120,29 +114,39 @@ class ClassMetadataFactoryTest extends \Doctrine\Tests\OrmTestCase { ...@@ -120,29 +114,39 @@ class ClassMetadataFactoryTest extends \Doctrine\Tests\OrmTestCase {
} }
/* Test subject class with overriden factory method for mocking purposes */ /* Test subject class with overriden factory method for mocking purposes */
class ClassMetadataFactoryTestSubject extends \Doctrine\ORM\Mapping\ClassMetadataFactory { class ClassMetadataFactoryTestSubject extends \Doctrine\ORM\Mapping\ClassMetadataFactory
{
private $_mockMetadata = array(); private $_mockMetadata = array();
private $_requestedClasses = array(); private $_requestedClasses = array();
/** @override */ /** @override */
protected function _newClassMetadataInstance($className) { protected function _newClassMetadataInstance($className)
{
$this->_requestedClasses[] = $className; $this->_requestedClasses[] = $className;
if ( ! isset($this->_mockMetadata[$className])) { if ( ! isset($this->_mockMetadata[$className])) {
throw new InvalidArgumentException("No mock metadata found for class $className."); throw new InvalidArgumentException("No mock metadata found for class $className.");
} }
return $this->_mockMetadata[$className]; return $this->_mockMetadata[$className];
} }
public function setMetadataForClass($className, $metadata) {
public function setMetadataForClass($className, $metadata)
{
$this->_mockMetadata[$className] = $metadata; $this->_mockMetadata[$className] = $metadata;
} }
public function getRequestedClasses() { return $this->_requestedClasses; }
public function getRequestedClasses()
{
return $this->_requestedClasses;
}
} }
/* Test classes */ /* Test classes */
class TestEntity1 { class TestEntity1
{
protected $name; protected $name;
protected $other; protected $other;
} }
class TestEntity2 extends TestEntity1 {} class TestEntity2 extends TestEntity1 {}
class TestEntity3 extends TestEntity2 {} class TestEntity3 extends TestEntity2 {}
\ No newline at end of file
...@@ -8,7 +8,8 @@ require_once __DIR__ . '/../../TestInit.php'; ...@@ -8,7 +8,8 @@ require_once __DIR__ . '/../../TestInit.php';
class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
{ {
public function testClassMetadataInstanceSerialization() { public function testClassMetadataInstanceSerialization()
{
$cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser'); $cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
// Test initial state // Test initial state
......
<?php
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'Orm_Performance_AllTests::main');
}
require_once 'lib/DoctrineTestInit.php';
// Tests
//...
class Orm_Performance_AllTests
{
public static function main()
{
PHPUnit_TextUI_TestRunner::run(self::suite());
}
public static function suite()
{
$suite = new Doctrine_TestSuite('Doctrine Orm Performance');
//$suite->addTestSuite('Orm_Performance_xxxTest');
return $suite;
}
}
if (PHPUnit_MAIN_METHOD == 'Orm_Performance_AllTests::main') {
Orm_Performance_AllTests::main();
}
...@@ -2,22 +2,12 @@ ...@@ -2,22 +2,12 @@
namespace Doctrine\Tests\ORM\Query; namespace Doctrine\Tests\ORM\Query;
if (!defined('PHPUnit_MAIN_METHOD')) { if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'Orm_Query_AllTests::main'); define('PHPUnit_MAIN_METHOD', 'Orm_Query_AllTests::main');
} }
require_once __DIR__ . '/../../TestInit.php'; require_once __DIR__ . '/../../TestInit.php';
#require_once 'IdentifierRecognitionTest.php';
/*require_once 'ScannerTest.php';
require_once 'DqlGenerationTest.php';
require_once 'DeleteSqlGenerationTest.php';
require_once 'UpdateSqlGenerationTest.php';
require_once 'SelectSqlGenerationTest.php';
require_once 'LanguageRecognitionTest.php';*/
class AllTests class AllTests
{ {
public static function main() public static function main()
...@@ -31,8 +21,9 @@ class AllTests ...@@ -31,8 +21,9 @@ class AllTests
$suite->addTestSuite('Doctrine\Tests\ORM\Query\IdentifierRecognitionTest'); $suite->addTestSuite('Doctrine\Tests\ORM\Query\IdentifierRecognitionTest');
$suite->addTestSuite('Doctrine\Tests\ORM\Query\SelectSqlGenerationTest'); $suite->addTestSuite('Doctrine\Tests\ORM\Query\SelectSqlGenerationTest');
/* /*
$suite->addTestSuite('Orm_Query_LanguageRecognitionTest'); $suite->addTestSuite('Doctrine\Tests\ORM\Query\LanguageRecognitionTest');
$suite->addTestSuite('Orm_Query_ScannerTest'); $suite->addTestSuite('Orm_Query_ScannerTest');
$suite->addTestSuite('Orm_Query_DqlGenerationTest'); $suite->addTestSuite('Orm_Query_DqlGenerationTest');
$suite->addTestSuite('Orm_Query_DeleteSqlGenerationTest'); $suite->addTestSuite('Orm_Query_DeleteSqlGenerationTest');
......
<?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.doctrine-project.org>.
*/
namespace Doctrine\Tests\ORM\Query; namespace Doctrine\Tests\ORM\Query;
require_once __DIR__ . '/../../TestInit.php'; require_once __DIR__ . '/../../TestInit.php';
/**
* Test case for testing the saving and referencing of query identifiers.
*
* @package Doctrine
* @subpackage Query
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Janne Vanhala <jpvanhal@cc.hut.fi>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.phpdoctrine.org
* @since 2.0
* @version $Revision$
* @todo 1) [romanb] We might want to split the SQL generation tests into multiple
* testcases later since we'll have a lot of them and we might want to have special SQL
* generation tests for some dbms specific SQL syntaxes.
*/
class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
{ {
private $_em; private $_em;
protected function setUp() { protected function setUp()
{
$this->_em = $this->_getTestEntityManager(); $this->_em = $this->_getTestEntityManager();
} }
......
<?php
require_once 'lib/DoctrineTestInit.php';
class Orm_Ticket_1Test extends Doctrine_OrmTestCase
{
public function testTest()
{
$this->assertEquals(0, 0);
}
}
\ No newline at end of file
<?php
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'Ticket_AllTests::main');
}
require_once 'lib/DoctrineTestInit.php';
// Tests
require_once 'Orm/Ticket/1Test.php';
class Orm_Ticket_AllTests
{
public static function main()
{
PHPUnit_TextUI_TestRunner::run(self::suite());
}
public static function suite()
{
$suite = new Doctrine_TestSuite('Doctrine Orm');
$suite->addTestSuite('Orm_Ticket_1Test');
return $suite;
}
}
if (PHPUnit_MAIN_METHOD == 'Ticket_AllTests::main') {
Ticket_AllTests::main();
}
\ No newline at end of file
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