tests\helpers\Factory::create PHP Method

create() public static method

public static create ( $class, $data = [] )
    public static function create($class, $data = [])
    {
        $instance = static::build($class, $data);
        $instance->save();
        return $instance->find($instance->id);
    }

Usage Example

示例#1
0
 public function test_Should_DeleteExistingServer()
 {
     $arrangedServer = Factory::create('App\\Models\\Server', ['name' => 'Server 1', 'description' => '', 'body' => '']);
     $serverRepository = new EloquentServer(new App\Models\Server());
     $serverRepository->delete($arrangedServer->id);
     $server = new App\Models\Server();
     $deletedServer = $server->find($arrangedServer->id);
     $this->assertNull($deletedServer);
 }
All Usage Examples Of tests\helpers\Factory::create