set('database.default', 'testbench'); $app['config']->set('database.connections.testbench', [ 'driver' => 'mysql', 'host' => 'localhost', 'database' => 'abc-api-testing', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'username' => 'abc-api', 'password' => 'sio2nf0d' ]); } protected function _before() { $this->startApplication(); $db = app()->make('db'); $db->beginTransaction(); $this->withFactories(__DIR__.'/factories'); } protected function _after() { $db = app()->make('db'); $db->rollBack(); $this->stopApplication(); } // tests: trying to... public function testMakeModel() { $name = "test1"; $model = new Person(); $model->name = $name; $this->assertInstanceOf(Person::class, $model); $this->assertEquals($name, $model->name); } public function testNameIsMassAssignable() { $name = "test1"; $model = Person::create(['name'=>$name]); $this->assertInstanceOf(Person::class, $model); $this->assertEquals($name, $model->name); } public function testFactorySetsName() { $model = factory(Person::class)->make([]); $this->assertInstanceOf(Person::class, $model); $this->assertNotEmpty($model->name); } }