1
0
mirror of synced 2024-12-13 14:56:01 +03:00
doctrine2/tests/ViewTestCase.php

44 lines
1.3 KiB
PHP
Raw Normal View History

2006-06-13 22:04:04 +04:00
<?php
class Doctrine_ViewTestCase extends Doctrine_UnitTestCase {
public function testCreateView() {
2006-08-22 03:20:33 +04:00
$query = new Doctrine_Query($this->connection);
2006-06-13 22:04:04 +04:00
$query->from('User');
2006-08-21 15:18:28 +04:00
$view = new Doctrine_View($query, 'MyView');
2006-06-13 22:04:04 +04:00
$this->assertEqual($view->getName(), 'MyView');
$this->assertEqual($view->getQuery(), $query);
$this->assertEqual($view, $query->getView());
$this->assertTrue($view->getDBH() instanceof PDO);
$success = true;
try {
$view->create();
} catch(Exception $e) {
$success = false;
}
$this->assertTrue($success);
$users = $view->execute();
$count = $this->dbh->count();
$this->assertTrue($users instanceof Doctrine_Collection);
$this->assertEqual($users->count(), 8);
$this->assertEqual($users[0]->name, 'zYne');
$this->assertEqual($users[0]->getState(), Doctrine_Record::STATE_CLEAN);
$this->assertEqual($count, $this->dbh->count());
$success = true;
try {
$view->drop();
} catch(Exception $e) {
$success = false;
}
$this->assertTrue($success);
}
2006-08-22 01:04:20 +04:00
public function testConstructor() {
2006-08-22 03:20:33 +04:00
}
2006-06-13 22:04:04 +04:00
}
?>