/**
  * Regression for issue #9
  * @see https://github.com/Vinelab/NeoEloquent/issues/9
  */
 public function testCreateModelWithMultiRelationOfSameRelatedModel()
 {
     $post = Post::createWith(['title' => 'tayta', 'body' => 'one hot bowy'], ['photos' => ['url' => 'my.photo.url'], 'cover' => ['url' => 'my.cover.url']]);
     $this->assertInstanceOf('Vinelab\\NeoEloquent\\Tests\\Functional\\QueryingRelations\\Post', $post);
     $this->assertEquals('my.photo.url', $post->photos->first()->url);
     $this->assertEquals('my.cover.url', $post->cover->url);
 }
 public function testCreatingModelWithMixedRelationsAndPassingCollection()
 {
     $tag = Tag::create(['title' => 'php']);
     $tags = [$tag, ['title' => 'developer'], new Tag(['title' => 'laravel'])];
     $post = Post::createWith(['title' => 'foo', 'body' => 'bar'], compact('tags'));
     $this->assertInstanceOf('Vinelab\\NeoEloquent\\Tests\\Functional\\QueryingRelations\\Post', $post);
     $related = $post->tags;
     $this->assertInstanceOf('Illuminate\\Database\\Eloquent\\Collection', $related);
     $this->assertEquals(3, count($related));
     $tags = Tag::all();
     $another = Post::createWith(['title' => 'foo', 'body' => 'bar'], compact('tags'));
     $this->assertInstanceOf('Vinelab\\NeoEloquent\\Tests\\Functional\\QueryingRelations\\Post', $another);
     $this->assertEquals(3, count($related));
 }
 public function testCreateWithReturnsRelatedModelsAsRelations()
 {
     $user = Post::createWith(['title' => 'foo tit', 'body' => 'some body'], ['cover' => ['url' => 'http://url'], 'tags' => ['title' => 'theTag']]);
     $relations = $user->getRelations();
     $this->assertArrayHasKey('cover', $relations);
     $cover = $user->toArray()['cover'];
     $this->assertArrayHasKey('id', $cover);
     $this->assertEquals('http://url', $cover['url']);
     $this->assertArrayHasKey('tags', $relations);
     $tags = $user->toArray()['tags'];
     $this->assertCount(1, $tags);
     $this->assertNotEmpty($tags[0]['id']);
     $this->assertEquals('theTag', $tags[0]['title']);
 }