Completed
Branch develop (ac330a)
by Abhishek Kumar
05:09
created
src/Jobs/ExportJob.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public function handle()
38 38
     {
39 39
         // Custom file path
40
-        $file_path = date( 'Y/m' );
40
+        $file_path = date('Y/m');
41 41
 
42 42
         // Export instance assign to variable
43 43
         $export = $this->export;
@@ -47,19 +47,19 @@  discard block
 block discarded – undo
47 47
         $export->save();
48 48
 
49 49
         // Create export file
50
-        $excel = Excel::create( 'export-' . date( 'dmYhis' ), function($excel) use ($export) {
50
+        $excel = Excel::create('export-'.date('dmYhis'), function($excel) use ($export) {
51 51
 
52 52
             // Create new sheet
53
-            $excel->sheet( 'export', function($sheet) use ($export) {
53
+            $excel->sheet('export', function($sheet) use ($export) {
54 54
 
55 55
                 // Retrive data in chunk
56
-                $export->query->chunk( 10, function($data) use ($export, $sheet) {
56
+                $export->query->chunk(10, function($data) use ($export, $sheet) {
57 57
 
58 58
                     // Process chunk data
59
-                    foreach ( $data as $row ) {
59
+                    foreach ($data as $row) {
60 60
                         
61 61
                         // Append row to sheet
62
-                        $sheet->appendRow( $row->toArray() );
62
+                        $sheet->appendRow($row->toArray());
63 63
 
64 64
                     }
65 65
 
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
 
72 72
             });
73 73
 
74
-        })->store( $this->export->type, storage_path( 'app/exports/' . $file_path ), true );
74
+        })->store($this->export->type, storage_path('app/exports/'.$file_path), true);
75 75
 
76 76
         // Update export data
77
-        $export->file = $file_path . '/' . $excel['file'];
77
+        $export->file = $file_path.'/'.$excel['file'];
78 78
         $export->completed_at = Carbon::now();
79 79
         $export->save();
80 80
 
Please login to merge, or discard this patch.
config/export.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@
 block discarded – undo
3 3
 return [
4 4
     // Route for export process ajax
5 5
     'export_progress' => [
6
-    	'url' => '/export/{id}/progress',
7
-    	'name' => 'ladybirdweb.export.ajax.progress'
6
+        'url' => '/export/{id}/progress',
7
+        'name' => 'ladybirdweb.export.ajax.progress'
8 8
     ],
9 9
 
10 10
     // Route for download exported file
11 11
     'export_download' => [
12
-    	'url' => '/export/{id}/download',
13
-    	'name' => 'ladybirdweb.export.download'
12
+        'url' => '/export/{id}/download',
13
+        'name' => 'ladybirdweb.export.download'
14 14
     ]
15 15
 ];
Please login to merge, or discard this patch.
config/import.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 return [
4 4
     // Route for import process ajax
5 5
     'import_progress' => [
6
-    	'url' => '/import/{id}/progress',
7
-    	'name' => 'ladybirdweb.import.ajax.progress'
6
+        'url' => '/import/{id}/progress',
7
+        'name' => 'ladybirdweb.import.ajax.progress'
8 8
     ]
9 9
 ];
Please login to merge, or discard this patch.
src/routes.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@
 block discarded – undo
3 3
 Route::middleware('web')->group(function() {
4 4
 
5 5
 // Ajax GET import progress
6
-Route::get( config( 'import.import_progress.url' ), [ 'as' => config( 'import.import_progress.name' ), 'uses' => 'Ladybirdweb\ImportExport\Import@returnImportProgress']);
6
+Route::get(config('import.import_progress.url'), ['as' => config('import.import_progress.name'), 'uses' => 'Ladybirdweb\ImportExport\Import@returnImportProgress']);
7 7
 
8 8
 // Ajax GET export progress
9
-Route::get( config( 'export.export_progress.url' ), [ 'as' => config( 'export.export_progress.name' ), 'uses' => 'Ladybirdweb\ImportExport\Export@returnExportProgress']);
9
+Route::get(config('export.export_progress.url'), ['as' => config('export.export_progress.name'), 'uses' => 'Ladybirdweb\ImportExport\Export@returnExportProgress']);
10 10
 
11 11
 // GET export download
12
-Route::get( config( 'export.export_download.url' ),  [ 'as' => config( 'export.export_download.name' ), 'uses' => 'Ladybirdweb\ImportExport\Export@downloadExportedFile']);
12
+Route::get(config('export.export_download.url'), ['as' => config('export.export_download.name'), 'uses' => 'Ladybirdweb\ImportExport\Export@downloadExportedFile']);
13 13
 
14 14
 });
Please login to merge, or discard this patch.
src/Import.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         // Store file path and model class to db
19 19
         $import = ModelImport::create([
20 20
             'file' => $path,
21
-            'file_rows' => count( file( storage_path( 'app/' . $path ) ) ) - 1,
21
+            'file_rows' => count(file(storage_path('app/'.$path))) - 1,
22 22
             'db_cols' => $columns
23 23
         ]);
24 24
 
@@ -33,28 +33,28 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public function getImport($id)
35 35
     {
36
-        return ModelImport::findOrFail( $id );
36
+        return ModelImport::findOrFail($id);
37 37
     }
38 38
 
39 39
     public function getImportFileData($id, $rows = 5)
40 40
     {
41 41
         // Get import instance
42
-        $import = $this->getImport( $id );
42
+        $import = $this->getImport($id);
43 43
         
44 44
         // Read 5 rows from csv
45 45
         $read_line = 1;
46 46
 
47
-        $file = fopen( storage_path( 'app/' . $import->file ), 'r' );
47
+        $file = fopen(storage_path('app/'.$import->file), 'r');
48 48
 
49
-        while ( $csv_line = fgetcsv( $file ) ) {
49
+        while ($csv_line = fgetcsv($file)) {
50 50
             $csv_data[] = $csv_line;
51 51
 
52
-            if ( $read_line > $rows ) break;
52
+            if ($read_line > $rows) break;
53 53
 
54 54
             $read_line++;
55 55
         }
56 56
         
57
-        fclose( $file );
57
+        fclose($file);
58 58
 
59 59
         return $csv_data;
60 60
     }
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
         $data['progress'] = round(($import->row_processed / $import->file_rows) * 100);
108 108
 
109 109
         // If progress completed return successful imported rows count
110
-        if ( $data['progress'] == 100 ) {
110
+        if ($data['progress'] == 100) {
111 111
             $data['imported'] = $import->row_imported;
112 112
         }
113 113
 
114
-        return response()->json( $data );
114
+        return response()->json($data);
115 115
     }
116 116
 
117 117
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     public function removeImport($id)
125 125
     {
126 126
         // Get import instance
127
-        $import = $this->getImport( $id );
127
+        $import = $this->getImport($id);
128 128
 
129 129
         // Remove a import from db
130 130
         return $import->delete();
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,9 @@
 block discarded – undo
49 49
         while ( $csv_line = fgetcsv( $file ) ) {
50 50
             $csv_data[] = $csv_line;
51 51
 
52
-            if ( $read_line > $rows ) break;
52
+            if ( $read_line > $rows ) {
53
+                break;
54
+            }
53 55
 
54 56
             $read_line++;
55 57
         }
Please login to merge, or discard this patch.
tests/ImportExportLogTest.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -11,61 +11,61 @@
 block discarded – undo
11 11
 
12 12
 class ImportExportLogTest extends TestCase
13 13
 {
14
-	use RefreshDatabase;
14
+    use RefreshDatabase;
15 15
 
16
-	protected $import;
16
+    protected $import;
17 17
 
18
-	protected function getPackageProviders($app)
19
-	{
20
-	    return ['Ladybirdweb\ImportExport\ImportExportServiceProvider'];
21
-	}
18
+    protected function getPackageProviders($app)
19
+    {
20
+        return ['Ladybirdweb\ImportExport\ImportExportServiceProvider'];
21
+    }
22 22
 
23 23
     protected function getEnvironmentSetUp($app)
24 24
     {
25 25
         $app['config']->set('database.default', 'testing');
26 26
     }
27 27
 
28
-	protected function setUp ()
29
-	{
30
-	    parent::setUp();
28
+    protected function setUp ()
29
+    {
30
+        parent::setUp();
31 31
 
32
-	    $this->artisan('migrate', ['--database' => 'testing']);
32
+        $this->artisan('migrate', ['--database' => 'testing']);
33 33
 
34
-		$this->import = Import::create([
35
-			'file' => 'imports/import-1530262997.csv',
36
-			'file_rows' => 104,
37
-			'db_cols' => [ 'name', 'email', 'password'],
38
-			'model_map' => ['email', 'name', 'password']
39
-		]);
40
-	}
34
+        $this->import = Import::create([
35
+            'file' => 'imports/import-1530262997.csv',
36
+            'file_rows' => 104,
37
+            'db_cols' => [ 'name', 'email', 'password'],
38
+            'model_map' => ['email', 'name', 'password']
39
+        ]);
40
+    }
41 41
 
42
-	/**
43
-	* @test
44
-	*/
45
-	public function save_new_log()
46
-	{
47
-		$import = $this->import;
42
+    /**
43
+     * @test
44
+     */
45
+    public function save_new_log()
46
+    {
47
+        $import = $this->import;
48 48
 
49
-		$result = ImportExportLog::logImportError( $import, ['data' => 'this is test data'], 'This is not expected' );
49
+        $result = ImportExportLog::logImportError( $import, ['data' => 'this is test data'], 'This is not expected' );
50 50
 
51
-		$this->assertInstanceOf( ModelImportExportLog::class, $result );
52
-	}
51
+        $this->assertInstanceOf( ModelImportExportLog::class, $result );
52
+    }
53 53
 
54
-	/**
55
-	* @test
56
-	*/
57
-	public function get_saved_logs()
58
-	{
59
-		$import = $this->import;
54
+    /**
55
+     * @test
56
+     */
57
+    public function get_saved_logs()
58
+    {
59
+        $import = $this->import;
60 60
 
61
-		$log = ImportExportLog::logImportError( $import, ['data' => 'this is test data'], 'This is not expected' );
61
+        $log = ImportExportLog::logImportError( $import, ['data' => 'this is test data'], 'This is not expected' );
62 62
 
63
-		$log_in_db = ImportExportLog::getLogs( $log->id );
63
+        $log_in_db = ImportExportLog::getLogs( $log->id );
64 64
 
65
-		$this->assertInternalType( 'array', $log_in_db );
65
+        $this->assertInternalType( 'array', $log_in_db );
66 66
 
67
-		$this->assertArrayHasKey( 'data', $log_in_db[0] );
67
+        $this->assertArrayHasKey( 'data', $log_in_db[0] );
68 68
 
69
-		$this->assertArrayHasKey( 'message', $log_in_db[0] );
70
-	}
69
+        $this->assertArrayHasKey( 'message', $log_in_db[0] );
70
+    }
71 71
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         $app['config']->set('database.default', 'testing');
26 26
     }
27 27
 
28
-	protected function setUp ()
28
+	protected function setUp()
29 29
 	{
30 30
 	    parent::setUp();
31 31
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		$this->import = Import::create([
35 35
 			'file' => 'imports/import-1530262997.csv',
36 36
 			'file_rows' => 104,
37
-			'db_cols' => [ 'name', 'email', 'password'],
37
+			'db_cols' => ['name', 'email', 'password'],
38 38
 			'model_map' => ['email', 'name', 'password']
39 39
 		]);
40 40
 	}
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
 	{
47 47
 		$import = $this->import;
48 48
 
49
-		$result = ImportExportLog::logImportError( $import, ['data' => 'this is test data'], 'This is not expected' );
49
+		$result = ImportExportLog::logImportError($import, ['data' => 'this is test data'], 'This is not expected');
50 50
 
51
-		$this->assertInstanceOf( ModelImportExportLog::class, $result );
51
+		$this->assertInstanceOf(ModelImportExportLog::class, $result);
52 52
 	}
53 53
 
54 54
 	/**
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
 	{
59 59
 		$import = $this->import;
60 60
 
61
-		$log = ImportExportLog::logImportError( $import, ['data' => 'this is test data'], 'This is not expected' );
61
+		$log = ImportExportLog::logImportError($import, ['data' => 'this is test data'], 'This is not expected');
62 62
 
63
-		$log_in_db = ImportExportLog::getLogs( $log->id );
63
+		$log_in_db = ImportExportLog::getLogs($log->id);
64 64
 
65
-		$this->assertInternalType( 'array', $log_in_db );
65
+		$this->assertInternalType('array', $log_in_db);
66 66
 
67
-		$this->assertArrayHasKey( 'data', $log_in_db[0] );
67
+		$this->assertArrayHasKey('data', $log_in_db[0]);
68 68
 
69
-		$this->assertArrayHasKey( 'message', $log_in_db[0] );
69
+		$this->assertArrayHasKey('message', $log_in_db[0]);
70 70
 	}
71 71
 }
Please login to merge, or discard this patch.
tests/ImportTest.php 2 patches
Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -15,115 +15,115 @@
 block discarded – undo
15 15
 
16 16
 class ImportTest extends TestCase
17 17
 {
18
-	use RefreshDatabase;
18
+    use RefreshDatabase;
19 19
 
20
-	protected $import;
20
+    protected $import;
21 21
 
22
-	protected function getPackageProviders($app)
23
-	{
24
-	    return ['Ladybirdweb\ImportExport\ImportExportServiceProvider'];
25
-	}
22
+    protected function getPackageProviders($app)
23
+    {
24
+        return ['Ladybirdweb\ImportExport\ImportExportServiceProvider'];
25
+    }
26 26
 
27 27
     protected function getEnvironmentSetUp($app)
28 28
     {
29 29
         $app['config']->set('database.default', 'testing');
30 30
     }
31 31
 
32
-	protected function setUp ()
33
-	{
34
-	    parent::setUp();
32
+    protected function setUp ()
33
+    {
34
+        parent::setUp();
35 35
 
36
-	    $this->artisan('migrate', ['--database' => 'testing']);
36
+        $this->artisan('migrate', ['--database' => 'testing']);
37 37
 
38
-	    Route::middleware('web')->group(function() {
38
+        Route::middleware('web')->group(function() {
39 39
 		    
40
-			Route::get( '/import/{id}/progress', [ 'as' => 'ladybirdweb.import.ajax.progress', 'uses' => 'Ladybirdweb\ImportExport\Import@returnImportProgress']);
41
-
42
-		});
43
-
44
-		Storage::putFileAs('imports', new File( __DIR__ . '/storage/test/test.csv' ), 'test.csv');
45
-
46
-		$this->import = ModelImport::create([
47
-			'file' => 'imports/test.csv',
48
-			'file_rows' => 104,
49
-			'db_cols' => [ 'name', 'email', 'password'],
50
-			'model_map' => ['email', 'name', 'password']
51
-		]);
52
-	}
53
-
54
-	/**
55
-	* @test
56
-	*/
57
-	public function create_new_import_success()
58
-	{
59
-		$import = Import::createImport('imports/test.csv', [ 'name', 'email', 'password']);
60
-
61
-		$this->assertInstanceOf(ModelImport::class, $import);
62
-	}
63
-
64
-	/**
65
-	* @test
66
-	*/
67
-	public function fetch_import()
68
-	{
69
-		$import = Import::getImport($this->import->id);
70
-
71
-		$this->assertInstanceOf(ModelImport::class, $import);
72
-	}
73
-
74
-	/**
75
-	* @test
76
-	*/
77
-	public function get_few_rows_from_uploaded_file()
78
-	{
79
-		$csv_data = Import::getImportFileData($this->import->id);
80
-
81
-		$this->assertInternalType( 'array', $csv_data );
82
-	}
83
-
84
-	/**
85
-	* @test
86
-	*/
87
-	public function store_data_map_with_csv_cols()
88
-	{
89
-		$import = Import::setDataMap(['email', 'name', 'password'], $this->import->id);
90
-
91
-		$this->assertInstanceOf(ModelImport::class, $import);
92
-	}
93
-
94
-	/**
95
-	* @test
96
-	*/
97
-	public function sucess_to_dispatch_given_job_class()
98
-	{
99
-		$import = $id = $this->import;
100
-
101
-		Queue::fake();
102
-
103
-		Import::dispatchImportJob( FakeJob::class, $import );
104
-
105
-		Queue::assertPushedOn('importing', FakeJob::class);
106
-	}
107
-
108
-	/**
109
-	* @test
110
-	*/
111
-	public function check_import_progress()
112
-	{
113
-		$response = $this->json( 'GET', '/import/1/progress' );
114
-
115
-		$response->assertStatus(200);
116
-
117
-		$response->assertJsonFragment( ['status' => 200] );
118
-
119
-		$response->assertJsonFragment( ['progress'] );
120
-	}
121
-
122
-	/**
123
-	* @test
124
-	*/
125
-	public function remove_import()
126
-	{
127
-		$this->assertTrue(Import::removeImport($this->import->id));
128
-	}
40
+            Route::get( '/import/{id}/progress', [ 'as' => 'ladybirdweb.import.ajax.progress', 'uses' => 'Ladybirdweb\ImportExport\Import@returnImportProgress']);
41
+
42
+        });
43
+
44
+        Storage::putFileAs('imports', new File( __DIR__ . '/storage/test/test.csv' ), 'test.csv');
45
+
46
+        $this->import = ModelImport::create([
47
+            'file' => 'imports/test.csv',
48
+            'file_rows' => 104,
49
+            'db_cols' => [ 'name', 'email', 'password'],
50
+            'model_map' => ['email', 'name', 'password']
51
+        ]);
52
+    }
53
+
54
+    /**
55
+     * @test
56
+     */
57
+    public function create_new_import_success()
58
+    {
59
+        $import = Import::createImport('imports/test.csv', [ 'name', 'email', 'password']);
60
+
61
+        $this->assertInstanceOf(ModelImport::class, $import);
62
+    }
63
+
64
+    /**
65
+     * @test
66
+     */
67
+    public function fetch_import()
68
+    {
69
+        $import = Import::getImport($this->import->id);
70
+
71
+        $this->assertInstanceOf(ModelImport::class, $import);
72
+    }
73
+
74
+    /**
75
+     * @test
76
+     */
77
+    public function get_few_rows_from_uploaded_file()
78
+    {
79
+        $csv_data = Import::getImportFileData($this->import->id);
80
+
81
+        $this->assertInternalType( 'array', $csv_data );
82
+    }
83
+
84
+    /**
85
+     * @test
86
+     */
87
+    public function store_data_map_with_csv_cols()
88
+    {
89
+        $import = Import::setDataMap(['email', 'name', 'password'], $this->import->id);
90
+
91
+        $this->assertInstanceOf(ModelImport::class, $import);
92
+    }
93
+
94
+    /**
95
+     * @test
96
+     */
97
+    public function sucess_to_dispatch_given_job_class()
98
+    {
99
+        $import = $id = $this->import;
100
+
101
+        Queue::fake();
102
+
103
+        Import::dispatchImportJob( FakeJob::class, $import );
104
+
105
+        Queue::assertPushedOn('importing', FakeJob::class);
106
+    }
107
+
108
+    /**
109
+     * @test
110
+     */
111
+    public function check_import_progress()
112
+    {
113
+        $response = $this->json( 'GET', '/import/1/progress' );
114
+
115
+        $response->assertStatus(200);
116
+
117
+        $response->assertJsonFragment( ['status' => 200] );
118
+
119
+        $response->assertJsonFragment( ['progress'] );
120
+    }
121
+
122
+    /**
123
+     * @test
124
+     */
125
+    public function remove_import()
126
+    {
127
+        $this->assertTrue(Import::removeImport($this->import->id));
128
+    }
129 129
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         $app['config']->set('database.default', 'testing');
30 30
     }
31 31
 
32
-	protected function setUp ()
32
+	protected function setUp()
33 33
 	{
34 34
 	    parent::setUp();
35 35
 
@@ -37,16 +37,16 @@  discard block
 block discarded – undo
37 37
 
38 38
 	    Route::middleware('web')->group(function() {
39 39
 		    
40
-			Route::get( '/import/{id}/progress', [ 'as' => 'ladybirdweb.import.ajax.progress', 'uses' => 'Ladybirdweb\ImportExport\Import@returnImportProgress']);
40
+			Route::get('/import/{id}/progress', ['as' => 'ladybirdweb.import.ajax.progress', 'uses' => 'Ladybirdweb\ImportExport\Import@returnImportProgress']);
41 41
 
42 42
 		});
43 43
 
44
-		Storage::putFileAs('imports', new File( __DIR__ . '/storage/test/test.csv' ), 'test.csv');
44
+		Storage::putFileAs('imports', new File(__DIR__.'/storage/test/test.csv'), 'test.csv');
45 45
 
46 46
 		$this->import = ModelImport::create([
47 47
 			'file' => 'imports/test.csv',
48 48
 			'file_rows' => 104,
49
-			'db_cols' => [ 'name', 'email', 'password'],
49
+			'db_cols' => ['name', 'email', 'password'],
50 50
 			'model_map' => ['email', 'name', 'password']
51 51
 		]);
52 52
 	}
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	*/
57 57
 	public function create_new_import_success()
58 58
 	{
59
-		$import = Import::createImport('imports/test.csv', [ 'name', 'email', 'password']);
59
+		$import = Import::createImport('imports/test.csv', ['name', 'email', 'password']);
60 60
 
61 61
 		$this->assertInstanceOf(ModelImport::class, $import);
62 62
 	}
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	{
79 79
 		$csv_data = Import::getImportFileData($this->import->id);
80 80
 
81
-		$this->assertInternalType( 'array', $csv_data );
81
+		$this->assertInternalType('array', $csv_data);
82 82
 	}
83 83
 
84 84
 	/**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
 		Queue::fake();
102 102
 
103
-		Import::dispatchImportJob( FakeJob::class, $import );
103
+		Import::dispatchImportJob(FakeJob::class, $import);
104 104
 
105 105
 		Queue::assertPushedOn('importing', FakeJob::class);
106 106
 	}
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
 	*/
111 111
 	public function check_import_progress()
112 112
 	{
113
-		$response = $this->json( 'GET', '/import/1/progress' );
113
+		$response = $this->json('GET', '/import/1/progress');
114 114
 
115 115
 		$response->assertStatus(200);
116 116
 
117
-		$response->assertJsonFragment( ['status' => 200] );
117
+		$response->assertJsonFragment(['status' => 200]);
118 118
 
119
-		$response->assertJsonFragment( ['progress'] );
119
+		$response->assertJsonFragment(['progress']);
120 120
 	}
121 121
 
122 122
 	/**
Please login to merge, or discard this patch.
tests/User.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,12 +29,12 @@
 block discarded – undo
29 29
 
30 30
 
31 31
     /**
32
-    * Password mulator
33
-    *
34
-    * Encrypt password while storing.
35
-    * @param $value
36
-    * @return void
37
-    */
32
+     * Password mulator
33
+     *
34
+     * Encrypt password while storing.
35
+     * @param $value
36
+     * @return void
37
+     */
38 38
     public function setPasswordAttribute($value)
39 39
     {
40 40
         $this->attributes['password'] = bcrypt( $value );
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,6 +37,6 @@
 block discarded – undo
37 37
     */
38 38
     public function setPasswordAttribute($value)
39 39
     {
40
-        $this->attributes['password'] = bcrypt( $value );
40
+        $this->attributes['password'] = bcrypt($value);
41 41
     }
42 42
 }
Please login to merge, or discard this patch.
tests/ExportTest.php 2 patches
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -16,102 +16,102 @@
 block discarded – undo
16 16
 
17 17
 class ExportTest extends TestCase
18 18
 {
19
-	use RefreshDatabase;
19
+    use RefreshDatabase;
20 20
 
21
-	protected $export;
21
+    protected $export;
22 22
 
23
-	protected function getPackageProviders($app)
24
-	{
25
-	    return ['Ladybirdweb\ImportExport\ImportExportServiceProvider'];
26
-	}
23
+    protected function getPackageProviders($app)
24
+    {
25
+        return ['Ladybirdweb\ImportExport\ImportExportServiceProvider'];
26
+    }
27 27
 
28 28
     protected function getEnvironmentSetUp($app)
29 29
     {
30 30
         $app['config']->set('database.default', 'testing');
31 31
     }
32 32
 
33
-	protected function setUp ()
34
-	{
35
-	    parent::setUp();
33
+    protected function setUp ()
34
+    {
35
+        parent::setUp();
36 36
 
37
-	    $this->artisan('migrate', ['--database' => 'testing']);
37
+        $this->artisan('migrate', ['--database' => 'testing']);
38 38
 
39
-	    Route::middleware('web')->group(function() {
39
+        Route::middleware('web')->group(function() {
40 40
 
41
-			Route::get('/ticket/export/{id}', [ 'as' => 'ticket.export.progress', 'uses' => 'Ladybirdweb\ImportExport\Export@showExportStatus']);
41
+            Route::get('/ticket/export/{id}', [ 'as' => 'ticket.export.progress', 'uses' => 'Ladybirdweb\ImportExport\Export@showExportStatus']);
42 42
 
43
-			Route::get( '/export/{id}/download',  [ 'as' => 'ladybirdweb.export.download', 'uses' => 'Ladybirdweb\ImportExport\Export@downloadExportedFile']);
43
+            Route::get( '/export/{id}/download',  [ 'as' => 'ladybirdweb.export.download', 'uses' => 'Ladybirdweb\ImportExport\Export@downloadExportedFile']);
44 44
 
45
-		});
45
+        });
46 46
 
47
-		Storage::putFileAs('exports', new File( __DIR__ . '/storage/test/test.csv' ), 'test.xls');
47
+        Storage::putFileAs('exports', new File( __DIR__ . '/storage/test/test.csv' ), 'test.xls');
48 48
 
49
-		$this->export = ModelExport::create([
50
-			'file' => 'test.xls',
51
-			'query' => User::select([ 'name', 'email', 'created_at' ])->getModel(),
52
-			'type' => 'xls'
53
-		]);
54
-	}
49
+        $this->export = ModelExport::create([
50
+            'file' => 'test.xls',
51
+            'query' => User::select([ 'name', 'email', 'created_at' ])->getModel(),
52
+            'type' => 'xls'
53
+        ]);
54
+    }
55 55
 
56
-	/**
57
-	* @test
58
-	*/
59
-	public function data_export_initiated_and_dispatched()
60
-	{
61
-		Queue::fake();
56
+    /**
57
+     * @test
58
+     */
59
+    public function data_export_initiated_and_dispatched()
60
+    {
61
+        Queue::fake();
62 62
 
63
-		$export = Export::export( User::select([ 'name', 'email', 'created_at' ]), 'xls' );
63
+        $export = Export::export( User::select([ 'name', 'email', 'created_at' ]), 'xls' );
64 64
 
65
-		$this->assertInstanceOf( ModelExport::class, $export );
65
+        $this->assertInstanceOf( ModelExport::class, $export );
66 66
 
67
-		Queue::assertPushedOn('exporting', ExportJob::class);
68
-	}
67
+        Queue::assertPushedOn('exporting', ExportJob::class);
68
+    }
69 69
 
70
-	/**
71
-	* @test
72
-	*/
73
-	public function see_export_progress_page()
74
-	{
75
-		$response =  $this->get('/ticket/export/' . $this->export->id);
70
+    /**
71
+     * @test
72
+     */
73
+    public function see_export_progress_page()
74
+    {
75
+        $response =  $this->get('/ticket/export/' . $this->export->id);
76 76
 
77
-		$response->assertStatus(200);
77
+        $response->assertStatus(200);
78 78
 
79
-		$response->assertSee('Export');
80
-	}
79
+        $response->assertSee('Export');
80
+    }
81 81
 
82
-	/**
83
-	* @test
84
-	*/
85
-	public function check_export_progress_ajax()
86
-	{
87
-		$response = $this->json( 'GET', '/export/' . $this->export->id . '/progress');
82
+    /**
83
+     * @test
84
+     */
85
+    public function check_export_progress_ajax()
86
+    {
87
+        $response = $this->json( 'GET', '/export/' . $this->export->id . '/progress');
88 88
 
89
-		$response->assertStatus(200);
89
+        $response->assertStatus(200);
90 90
 
91
-		$response->assertJsonFragment( ['status' => 200] );
91
+        $response->assertJsonFragment( ['status' => 200] );
92 92
 
93
-		$response->assertJsonFragment( ['progress'] );
94
-	}
93
+        $response->assertJsonFragment( ['progress'] );
94
+    }
95 95
 
96
-	/**
97
-	* @test
98
-	*/
99
-	public function try_download_exported_file()
100
-	{
101
-		$response = $this->get('/export/' . $this->export->id . '/download');
96
+    /**
97
+     * @test
98
+     */
99
+    public function try_download_exported_file()
100
+    {
101
+        $response = $this->get('/export/' . $this->export->id . '/download');
102 102
 
103
-		$response->assertHeader( 'content-disposition', 'attachment; filename="test.xls"');
103
+        $response->assertHeader( 'content-disposition', 'attachment; filename="test.xls"');
104 104
 
105
-		$response->assertStatus(200);
106
-	}
105
+        $response->assertStatus(200);
106
+    }
107 107
 
108
-	/**
109
-	* @test
110
-	*/
111
-	public function fail_download_exported_file()
112
-	{
113
-		$response = $this->get('/export/987654321/download');
108
+    /**
109
+     * @test
110
+     */
111
+    public function fail_download_exported_file()
112
+    {
113
+        $response = $this->get('/export/987654321/download');
114 114
 
115
-		$response->assertStatus(404);
116
-	}
115
+        $response->assertStatus(404);
116
+    }
117 117
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         $app['config']->set('database.default', 'testing');
31 31
     }
32 32
 
33
-	protected function setUp ()
33
+	protected function setUp()
34 34
 	{
35 35
 	    parent::setUp();
36 36
 
@@ -38,17 +38,17 @@  discard block
 block discarded – undo
38 38
 
39 39
 	    Route::middleware('web')->group(function() {
40 40
 
41
-			Route::get('/ticket/export/{id}', [ 'as' => 'ticket.export.progress', 'uses' => 'Ladybirdweb\ImportExport\Export@showExportStatus']);
41
+			Route::get('/ticket/export/{id}', ['as' => 'ticket.export.progress', 'uses' => 'Ladybirdweb\ImportExport\Export@showExportStatus']);
42 42
 
43
-			Route::get( '/export/{id}/download',  [ 'as' => 'ladybirdweb.export.download', 'uses' => 'Ladybirdweb\ImportExport\Export@downloadExportedFile']);
43
+			Route::get('/export/{id}/download', ['as' => 'ladybirdweb.export.download', 'uses' => 'Ladybirdweb\ImportExport\Export@downloadExportedFile']);
44 44
 
45 45
 		});
46 46
 
47
-		Storage::putFileAs('exports', new File( __DIR__ . '/storage/test/test.csv' ), 'test.xls');
47
+		Storage::putFileAs('exports', new File(__DIR__.'/storage/test/test.csv'), 'test.xls');
48 48
 
49 49
 		$this->export = ModelExport::create([
50 50
 			'file' => 'test.xls',
51
-			'query' => User::select([ 'name', 'email', 'created_at' ])->getModel(),
51
+			'query' => User::select(['name', 'email', 'created_at'])->getModel(),
52 52
 			'type' => 'xls'
53 53
 		]);
54 54
 	}
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	{
61 61
 		Queue::fake();
62 62
 
63
-		$export = Export::export( User::select([ 'name', 'email', 'created_at' ]), 'xls' );
63
+		$export = Export::export(User::select(['name', 'email', 'created_at']), 'xls');
64 64
 
65
-		$this->assertInstanceOf( ModelExport::class, $export );
65
+		$this->assertInstanceOf(ModelExport::class, $export);
66 66
 
67 67
 		Queue::assertPushedOn('exporting', ExportJob::class);
68 68
 	}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	*/
73 73
 	public function see_export_progress_page()
74 74
 	{
75
-		$response =  $this->get('/ticket/export/' . $this->export->id);
75
+		$response = $this->get('/ticket/export/'.$this->export->id);
76 76
 
77 77
 		$response->assertStatus(200);
78 78
 
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
 	*/
85 85
 	public function check_export_progress_ajax()
86 86
 	{
87
-		$response = $this->json( 'GET', '/export/' . $this->export->id . '/progress');
87
+		$response = $this->json('GET', '/export/'.$this->export->id.'/progress');
88 88
 
89 89
 		$response->assertStatus(200);
90 90
 
91
-		$response->assertJsonFragment( ['status' => 200] );
91
+		$response->assertJsonFragment(['status' => 200]);
92 92
 
93
-		$response->assertJsonFragment( ['progress'] );
93
+		$response->assertJsonFragment(['progress']);
94 94
 	}
95 95
 
96 96
 	/**
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 	*/
99 99
 	public function try_download_exported_file()
100 100
 	{
101
-		$response = $this->get('/export/' . $this->export->id . '/download');
101
+		$response = $this->get('/export/'.$this->export->id.'/download');
102 102
 
103
-		$response->assertHeader( 'content-disposition', 'attachment; filename="test.xls"');
103
+		$response->assertHeader('content-disposition', 'attachment; filename="test.xls"');
104 104
 
105 105
 		$response->assertStatus(200);
106 106
 	}
Please login to merge, or discard this patch.