protected function setUp() { $this->query = $this->getMock('Symfony\\Bridge\\Propel1\\Tests\\Fixtures\\ItemQuery', array('filterById'), array(), '', true, true, true, false, true); $this->query->expects($this->any())->method('filterById')->with($this->anything())->will($this->returnSelf()); $this->createItems(); ItemQuery::$result = array($this->item1, $this->item2, $this->item3, $this->item4); parent::setUp(); }
/** * @group legacy */ public function testLegacyDifferentEqualObjectsAreChoosen() { $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); $item = new Item(1, 'Foo'); ItemQuery::$result = array($item); $choiceList = new ModelChoiceList(self::ITEM_CLASS, 'value', array($item)); $choosenItem = new Item(1, 'Foo'); $this->assertEquals(array(1), $choiceList->getIndicesForChoices(array($choosenItem))); }
public function testDifferentEqualObjectsAreChoosen() { $item = new Item(1, 'Foo'); ItemQuery::$result = array($item); $choiceList = new ModelChoiceList(self::ITEM_CLASS, 'value', array($item)); $choosenItem = new Item(1, 'Foo'); $this->assertEquals(array(1), $choiceList->getIndicesForChoices(array($choosenItem))); $this->assertEquals(array('1'), $choiceList->getValuesForChoices(array($choosenItem))); }