assertEquals(1, $this->_countForeignKeys($firstId, $secondId)); } public function assertForeignKeysNotContain($firstId, $secondId) { $this->assertEquals(0, $this->_countForeignKeys($firstId, $secondId)); } protected function _countForeignKeys($firstId, $secondId) { return count($this->_em->getConnection() ->execute("SELECT {$this->_firstField} FROM {$this->_table} WHERE {$this->_firstField}=? AND {$this->_secondField}=?", array($firstId, $secondId)) ->fetchAll()); } public function assertCollectionEquals(Collection $first, Collection $second) { return $first->forAll(function($k, $e) use($second) { return $second->contains($e); }); /*if (count($first) != count($second)) { return false; } foreach ($first as $element) { if (!$second->contains($element)) { return false; } } return true;*/ } }