/** @test **/ public function it_has_an_incremental_id_on_save() { createEntity('author'); $builder = new Builder('Author'); $builder->insert(['name' => 'Shawn Spencer', 'email' => '*****@*****.**']); $builder->insert(['name' => 'Burton Guster', 'email' => '*****@*****.**']); $authors = $builder->get(); $shawn = $authors[0]; $gus = $authors[1]; $this->assertEquals(1, $shawn->id); $this->assertEquals(2, $gus->id); }
/** @test **/ public function it_finds_the_object_with_the_given_id() { createEntity('author'); $author = new Author(['name' => 'Shawn Spencer', 'email' => '*****@*****.**']); $id = $author->save()->id; $author = (new Author())->find($id); //$this->assertEquals('Shawn Spencer', $author->name); }