Commit ec8f446f authored by zYne's avatar zYne

Fixes #175

parent c1280d31
......@@ -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]))
......
<?php
class Doctrine_Collection_OffsetTestCase extends Doctrine_UnitTestCase {
class Doctrine_Collection_Offset_TestCase extends Doctrine_UnitTestCase {
public function testExpand() {
$users = $this->connection->query("FROM User-o");
......
......@@ -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();
......
......@@ -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());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment