Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
/*
4
 * This file is part of the symfony package.
5
 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
 
11
$app = 'frontend';
12
$fixtures = 'fixtures/fixtures.yml';
13
require_once(dirname(__FILE__).'/../bootstrap/functional.php');
14
 
15
$t = new lime_test(12);
16
 
17
// Make sure Author records were populated properly
18
$q = Doctrine_Query::create()
19
  ->from('Author a');
20
$results = $q->fetchArray();
21
 
22
$t->is(count($results), 2);
23
$t->is($results[0]['name'], 'Jonathan H. Wage');
24
$t->is($results[1]['name'], 'Fabien POTENCIER');
25
 
26
// Make sure data fixtures were loaded
27
$q = Doctrine_Query::create()
28
  ->from('Article a')
29
  ->leftJoin('a.Translation t');
30
 
31
$articles = $q->fetchArray();
32
$t->is($articles[0]['Translation']['en']['title'], 'English Title');
33
 
34
$manager = Doctrine_Manager::getInstance();
35
$conn1 = $manager->getConnection('doctrine1');
36
$conn2 = $manager->getConnection('doctrine2');
37
$conn3 = $manager->getConnection('doctrine3');
38
 
39
// Make sure all connections are created properly from databases.yml
40
$t->is(count($manager), 3);
41
$t->is($conn1->getOption('dsn'), 'sqlite:' . str_replace(DIRECTORY_SEPARATOR, '/', sfConfig::get('sf_data_dir')) . '/database1.sqlite');
42
$t->is($conn2->getOption('dsn'), 'sqlite:' . str_replace(DIRECTORY_SEPARATOR, '/', sfConfig::get('sf_data_dir')) . '/database2.sqlite');
43
$t->is($conn3->getOption('dsn'), 'sqlite:' . str_replace(DIRECTORY_SEPARATOR, '/', sfConfig::get('sf_data_dir')) . '/database3.sqlite');
44
 
45
// Set globally by ProjectConfiguration::configureDoctrine()
46
$t->is($manager->getAttribute(Doctrine_Core::ATTR_VALIDATE), true);
47
 
48
// We disable validation for the doctrine2 connection in ProjectConfiguration::configureDoctrineConnectionDoctrine2()
49
$t->is($conn2->getAttribute(Doctrine_Core::ATTR_VALIDATE), false);
50
 
51
// We set export attribute on the connection in databases.yml
52
$t->is($conn3->getAttribute(Doctrine_Core::ATTR_EXPORT), Doctrine_Core::EXPORT_TABLES);
53
 
54
$article = new ReflectionClass('Article');
55
$parent = new ReflectionClass('myDoctrineRecord');
56
$t->is($article->isSubclassOf($parent), true);