Skip to content

Instantly share code, notes, and snippets.

@anyt
Created January 6, 2014 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anyt/8286331 to your computer and use it in GitHub Desktop.
Save anyt/8286331 to your computer and use it in GitHub Desktop.
<?php
class ManyToManyTest extends \PHPUnit_Framework_TestCase
{
public function testSynchronization()
{
$post = new Post();
$tag = new Tag();
$post->addTag($tag);
// $tag not contains the $post
$this->assertFalse($tag->getPosts()->contains($post));
$tag->addPost($post);
// now $tag contains the $post
$this->assertTrue($tag->getPosts()->contains($post));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment