Exemplo n.º 1
0
 /**
  * Tests that replaceLink requires the sourceEntity to have primaryKey values
  * for the source entity
  *
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage Could not find primary key value for source entity
  * @return void
  */
 public function testReplaceWithMissingPrimaryKey()
 {
     $config = ['sourceTable' => $this->article, 'targetTable' => $this->tag, 'joinTable' => 'tags_articles'];
     $assoc = new BelongsToMany('Test', $config);
     $entity = new Entity(['foo' => 1], ['markNew' => false]);
     $tags = [new Entity(['id' => 2]), new Entity(['id' => 3])];
     $assoc->replaceLinks($entity, $tags);
 }