1
0
mirror of synced 2024-12-14 07:06:04 +03:00
This commit is contained in:
zYne 2007-01-27 10:11:25 +00:00
parent 25f1d5e8ff
commit 871e73fe0e
4 changed files with 163 additions and 17 deletions

View File

@ -1,6 +1,39 @@
<?php
class Doctrine_Export_Firebird_TestCase extends Doctrine_UnitTestCase {
public function testCreateDatabaseDoesNotExecuteSql() {
/*
* $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_Export_Firebird_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_Export_Firebird_TestCase extends Doctrine_UnitTestCase
{
public function testCreateDatabaseDoesNotExecuteSql()
{
try {
$this->export->createDatabase('db');
$this->fail();
@ -8,7 +41,8 @@ class Doctrine_Export_Firebird_TestCase extends Doctrine_UnitTestCase {
$this->pass();
}
}
public function testDropDatabaseDoesNotExecuteSql() {
public function testDropDatabaseDoesNotExecuteSql()
{
try {
$this->export->dropDatabase('db');
$this->fail();
@ -16,7 +50,8 @@ class Doctrine_Export_Firebird_TestCase extends Doctrine_UnitTestCase {
$this->pass();
}
}
public function testCreateTableSupportsAutoincPks() {
public function testCreateTableSupportsAutoincPks()
{
$name = 'mytable';
$fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true));
@ -31,7 +66,8 @@ class Doctrine_Export_Firebird_TestCase extends Doctrine_UnitTestCase {
NEW.id = GEN_ID(mytable_seq, 1);
END');
}
public function testCreateTableSupportsDefaultAttribute() {
public function testCreateTableSupportsDefaultAttribute()
{
$name = 'mytable';
$fields = array('name' => array('type' => 'char', 'length' => 10, 'default' => 'def'),
'type' => array('type' => 'integer', 'length' => 3, 'default' => 12)
@ -42,7 +78,8 @@ class Doctrine_Export_Firebird_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10) DEFAULT \'def\', type INT DEFAULT 12, PRIMARY KEY(name, type))');
}
public function testCreateTableSupportsMultiplePks() {
public function testCreateTableSupportsMultiplePks()
{
$name = 'mytable';
$fields = array('name' => array('type' => 'char', 'length' => 10),
'type' => array('type' => 'integer', 'length' => 3));

View File

@ -1,4 +1,35 @@
<?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_Export_Oracle_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_Export_Oracle_TestCase extends Doctrine_UnitTestCase {
public function testCreateSequenceExecutesSql() {
$sequenceName = 'sequence';

View File

@ -1,6 +1,39 @@
<?php
class Doctrine_Query_From_TestCase extends Doctrine_UnitTestCase {
public function testLeftJoin() {
/*
* $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_Export_Oracle_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_From_TestCase extends Doctrine_UnitTestCase
{
public function testLeftJoin()
{
$q = new Doctrine_Query();
$q->from('User u LEFT JOIN u.Group');
@ -10,7 +43,8 @@ class Doctrine_Query_From_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($users->count(), 8);
}
public function testDefaultJoinIsLeftJoin() {
public function testDefaultJoinIsLeftJoin()
{
$q = new Doctrine_Query();
$q->from('User u JOIN u.Group');
@ -20,7 +54,8 @@ class Doctrine_Query_From_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($users->count(), 8);
}
public function testInnerJoin() {
public function testInnerJoin()
{
$q = new Doctrine_Query();
$q->from('User u INNER JOIN u.Group');
@ -30,7 +65,8 @@ class Doctrine_Query_From_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($users->count(), 1);
}
public function testMultipleLeftJoin() {
public function testMultipleLeftJoin()
{
$q = new Doctrine_Query();
$q->from('User u LEFT JOIN u.Group LEFT JOIN u.Phonenumber');
@ -40,7 +76,8 @@ class Doctrine_Query_From_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($users->count(), 8);
}
public function testMultipleLeftJoin2() {
public function testMultipleLeftJoin2()
{
$q = new Doctrine_Query();
$q->from('User u LEFT JOIN u.Group LEFT JOIN u.Phonenumber');
@ -50,7 +87,8 @@ class Doctrine_Query_From_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($users->count(), 8);
}
public function testMultipleInnerJoin() {
public function testMultipleInnerJoin()
{
$q = new Doctrine_Query();
$q->select('u.name')->from('User u INNER JOIN u.Group INNER JOIN u.Phonenumber');
@ -60,7 +98,8 @@ class Doctrine_Query_From_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($users->count(), 1);
}
public function testMultipleInnerJoin2() {
public function testMultipleInnerJoin2()
{
$q = new Doctrine_Query();
$q->select('u.name')->from('User u INNER JOIN u.Group, u.Phonenumber');
@ -70,7 +109,8 @@ class Doctrine_Query_From_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($users->count(), 1);
}
public function testMixingOfJoins() {
public function testMixingOfJoins()
{
$q = new Doctrine_Query();
$q->select('u.name, g.name, p.phonenumber')->from('User u INNER JOIN u.Group g LEFT JOIN u.Phonenumber p');

View File

@ -1,6 +1,40 @@
<?php
class Doctrine_Query_Subquery_TestCase extends Doctrine_UnitTestCase {
public function testSubqueryWithWherePartAndInExpression() {
/*
* $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_Subquery_TestCase
* This test case is used for testing DQL subquery functionality
*
* @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_Subquery_TestCase extends Doctrine_UnitTestCase
{
public function testSubqueryWithWherePartAndInExpression()
{
$q = new Doctrine_Query();
$q->from('User')->where("User.id NOT IN (FROM User(id) WHERE User.name = 'zYne')");
@ -12,5 +46,9 @@ class Doctrine_Query_Subquery_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($users->count(), 7);
$this->assertEqual($users[0]->name, 'Arnold Schwarzenegger');
}
public function testSubqueryAllowsSelectingOfAnyField()
{
}
}
?>