Esempio n. 1
0
 /**
  * Test whether calling setDistinct twice puts in two distinct keywords or not.
  * @link       http://propel.phpdb.org/trac/ticket/716
  */
 public function testDoubleSelectModifiers()
 {
     $c = new Criteria();
     $c->setDistinct();
     $this->assertEquals(array(Criteria::DISTINCT), $c->getSelectModifiers(), 'Initial setDistinct works');
     $c->setDistinct();
     $this->assertEquals(array(Criteria::DISTINCT), $c->getSelectModifiers(), 'Calling setDistinct again leaves a single distinct');
     $c->setAll();
     $this->assertEquals(array(Criteria::ALL), $c->getSelectModifiers(), 'All keyword is swaps distinct out');
     $c->setAll();
     $this->assertEquals(array(Criteria::ALL), $c->getSelectModifiers(), 'Calling setAll leaves a single all');
     $c->setDistinct();
     $this->assertEquals(array(Criteria::DISTINCT), $c->getSelectModifiers(), 'All back to distinct works');
     $c2 = new Criteria();
     $c2->setAll();
     $this->assertEquals(array(Criteria::ALL), $c2->getSelectModifiers(), 'Initial setAll works');
 }
Esempio n. 2
0
 public function testMergeWithSelectModifiers()
 {
     $c1 = new Criteria();
     $c1->setDistinct();
     $c2 = new Criteria();
     $c1->mergeWith($c2);
     $this->assertEquals(array(Criteria::DISTINCT), $c1->getSelectModifiers(), 'mergeWith() does not remove an existing select modifier');
     $c1 = new Criteria();
     $c2 = new Criteria();
     $c2->setDistinct();
     $c1->mergeWith($c2);
     $this->assertEquals(array(Criteria::DISTINCT), $c1->getSelectModifiers(), 'mergeWith() merges the select modifiers');
     $c1 = new Criteria();
     $c1->setDistinct();
     $c2 = new Criteria();
     $c2->setDistinct();
     $c1->mergeWith($c2);
     $this->assertEquals(array(Criteria::DISTINCT), $c1->getSelectModifiers(), 'mergeWith() does not duplicate select modifiers');
     $c1 = new Criteria();
     $c1->setAll();
     $c2 = new Criteria();
     $c2->setDistinct();
     $c1->mergeWith($c2);
     $this->assertEquals(array(Criteria::ALL), $c1->getSelectModifiers(), 'mergeWith() does not merge the select modifiers in case of conflict');
 }