Skip to content

Commit

Permalink
Add failing test case proofing doctrine#682
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterj committed Jan 9, 2016
1 parent bfcfa97 commit ffdedb9
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Doctrine\Tests\Models\CMS\CmsTeamUser;
use Doctrine\Tests\Models\CMS\CmsUser;
use Doctrine\Tests\Models\CMS\CmsAddress;
use Doctrine\Tests\ODM\PHPCR\PHPCRFunctionalTestCase;
use Doctrine\ODM\PHPCR\Query\Builder\AbstractNode as QBConstants;

Expand Down Expand Up @@ -212,4 +213,25 @@ public function testFindOneBy()
$users2 = $this->dm->getRepository('Doctrine\Tests\Models\CMS\CmsUser')->findOneBy(array('username' =>'obama'));
$this->assertEquals(null, $users2);
}

public function testFindByAssociatedDocument()
{
$address1 = new CmsAddress;
$address1->country = 'France';
$address1->city = 'Lyon';
$address1->zip = '65019';

$user1 = new CmsUser();
$user1->username = "beberlei";
$user1->status = "active";
$user1->name = "Benjamin";
$user1->address = $address1;

$this->dm->persist($address1);
$this->dm->persist($user1);
$this->dm->flush();

$user = $this->dm->getRepository('Doctrine\Tests\Models\CMS\CmsUser')->findOneBy(array('address' => $address1));
$this->assertEquals($user1->username, $user->username);
}
}

0 comments on commit ffdedb9

Please sign in to comment.