X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=vendor%2Fdoctrine%2Form%2Ftests%2FDoctrine%2FTests%2FORM%2FFunctional%2FAbstractManyToManyAssociationTestCase.php;fp=vendor%2Fdoctrine%2Form%2Ftests%2FDoctrine%2FTests%2FORM%2FFunctional%2FAbstractManyToManyAssociationTestCase.php;h=f11ad26225910e9382ed46d4614a4bc661cb3068;hb=8b04b2d11798dee4f3e1358e4f43e97a6df851f6;hp=0000000000000000000000000000000000000000;hpb=73568cf05a785a45f94ca3f2351d9e07bf917958;p=zf2.biz%2Fapplication_blanche.git diff --git a/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Functional/AbstractManyToManyAssociationTestCase.php b/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Functional/AbstractManyToManyAssociationTestCase.php new file mode 100644 index 0000000..f11ad26 --- /dev/null +++ b/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Functional/AbstractManyToManyAssociationTestCase.php @@ -0,0 +1,42 @@ +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()->executeQuery(" + 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); }); + } +}