public function testCreateWithManyToManyAssociation()
{
$this->phactory->define('tag', array('name' => 'Test Tag'));
$this->phactory->define('blog', array('title' => 'Test Title'), array('tag' => $this->phactory->manyToMany('tags', 'blogs_tags', 'id', 'blog_id', 'tag_id', 'id')));
$tag = $this->phactory->create('tag');
$blog = $this->phactory->createWithAssociations('blog', array('tag' => $tag));
$result = $this->pdo->query("SELECT * FROM blogs_tags");
$row = $result->fetch();
$result->closeCursor();
$this->assertNotEquals(false, $row);
$this->assertEquals($blog->getId(), $row['blog_id']);
$this->assertEquals($tag->getId(), $row['tag_id']);
}