3 namespace Doctrine\Tests\ORM\Functional\SchemaTool;
5 use Doctrine\DBAL\Schema\Schema;
7 require_once __DIR__ . '/../../../TestInit.php';
10 * Functional tests for the Class Table Inheritance mapping strategy.
14 class CompanySchemaTest extends \Doctrine\Tests\OrmFunctionalTestCase
16 protected function setUp()
18 $this->useModelSet('company');
26 public function testGeneratedSchema()
28 $schema = $this->_em->getConnection()->getSchemaManager()->createSchema();
30 $this->assertTrue($schema->hasTable('company_contracts'));
37 * @depends testGeneratedSchema
39 public function testSingleTableInheritance(Schema $schema)
41 $table = $schema->getTable('company_contracts');
43 // Check nullability constraints
44 $this->assertTrue($table->getColumn('id')->getNotnull());
45 $this->assertTrue($table->getColumn('completed')->getNotnull());
46 $this->assertFalse($table->getColumn('salesPerson_id')->getNotnull());
47 $this->assertTrue($table->getColumn('discr')->getNotnull());
48 $this->assertFalse($table->getColumn('fixPrice')->getNotnull());
49 $this->assertFalse($table->getColumn('hoursWorked')->getNotnull());
50 $this->assertFalse($table->getColumn('pricePerHour')->getNotnull());
51 $this->assertFalse($table->getColumn('maxPrice')->getNotnull());
57 public function testDropPartSchemaWithForeignKeys()
59 if (!$this->_em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) {
60 $this->markTestSkipped("Foreign Key test");
63 $sql = $this->_schemaTool->getDropSchemaSQL(array(
64 $this->_em->getClassMetadata('Doctrine\Tests\Models\Company\CompanyManager'),
66 $this->assertEquals(4, count($sql));