From ec8f446fadc8f0100845d8a8c284776369952b95 Mon Sep 17 00:00:00 2001 From: zYne Date: Wed, 18 Oct 2006 20:17:49 +0000 Subject: [PATCH] Fixes #175 --- lib/Doctrine/Collection.php | 3 +-- tests/CollectionOffsetTestCase.php | 2 +- tests/QueryTestCase.php | 9 ++------- tests/run.php | 5 ++++- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/Doctrine/Collection.php b/lib/Doctrine/Collection.php index efe0fa239..8cce4b621 100644 --- a/lib/Doctrine/Collection.php +++ b/lib/Doctrine/Collection.php @@ -500,9 +500,8 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator if(isset($this->reference_field)) $record->set($this->reference_field, $this->reference, false); - if(in_array($record,$this->data)) { + if(array_search($record, $this->data) !== false) return false; - } if(isset($key)) { if(isset($this->data[$key])) diff --git a/tests/CollectionOffsetTestCase.php b/tests/CollectionOffsetTestCase.php index 6af0c68e1..a6d527945 100644 --- a/tests/CollectionOffsetTestCase.php +++ b/tests/CollectionOffsetTestCase.php @@ -1,5 +1,5 @@ connection->query("FROM User-o"); diff --git a/tests/QueryTestCase.php b/tests/QueryTestCase.php index f1083b1d2..36c7a473c 100644 --- a/tests/QueryTestCase.php +++ b/tests/QueryTestCase.php @@ -986,15 +986,10 @@ class Doctrine_Query_TestCase extends Doctrine_UnitTestCase { $this->assertTrue($query instanceof Doctrine_Query); $this->assertEqual($query->get("offset"), 5); - $query->offset = 7; - $this->assertEqual($query->get("offset"), 7); - - $query->limit = 10; - $this->assertEqual($query->limit, 10); - $this->assertTrue(strpos($query->getQuery(),"LIMIT")); - $query->remove('limit')->remove('offset'); + $this->assertFalse(strpos($query->getQuery(),"OFFSET")); + $this->assertFalse(strpos($query->getQuery(),"LIMIT")); $coll = $query->execute(); diff --git a/tests/run.php b/tests/run.php index 2e250af73..cbb0abab6 100644 --- a/tests/run.php +++ b/tests/run.php @@ -39,6 +39,7 @@ require_once("QueryComponentAliasTestCase.php"); require_once("QuerySubqueryTestCase.php"); require_once("QuerySelectTestCase.php"); require_once("QueryDeleteTestCase.php"); +require_once("QueryUpdateTestCase.php"); require_once("DBTestCase.php"); require_once("SchemaTestCase.php"); @@ -81,7 +82,7 @@ $test->addTestCase(new Doctrine_BatchIteratorTestCase()); $test->addTestCase(new Doctrine_ConfigurableTestCase()); -$test->addTestCase(new Doctrine_Collection_OffsetTestCase()); +//$test->addTestCase(new Doctrine_Collection_Offset_TestCase()); $test->addTestCase(new Doctrine_PessimisticLockingTestCase()); @@ -135,6 +136,8 @@ $test->addTestCase(new Doctrine_Query_Select_TestCase()); $test->addTestCase(new Doctrine_Query_Delete_TestCase()); +$test->addTestCase(new Doctrine_Query_Update_TestCase()); + //$test->addTestCase(new Doctrine_Cache_FileTestCase()); //$test->addTestCase(new Doctrine_Cache_SqliteTestCase());