@@ -29,7 +29,7 @@ discard block |
||
| 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 |
||
| 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( storage_path( 'test/test.csv' ) ), 'test.csv'); |
|
| 44 | + Storage::putFileAs('imports', new File(storage_path('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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | /** |
@@ -30,7 +30,7 @@ discard block |
||
| 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 |
||
| 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( storage_path( 'test/test.csv' ) ), 'test.xls'); |
|
| 47 | + Storage::putFileAs('exports', new File(storage_path('test/test.csv')), 'test.xls'); |
|
| 48 | 48 | |
| 49 | 49 | $this->export = ModelExport::create([ |
| 50 | 50 | 'file' => 'test.xls', |
| 51 | - 'query' => \App\Models\User::select([ 'name', 'email', 'created_at' ])->getModel(), |
|
| 51 | + 'query' => \App\Models\User::select(['name', 'email', 'created_at'])->getModel(), |
|
| 52 | 52 | 'type' => 'xls' |
| 53 | 53 | ]); |
| 54 | 54 | } |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | { |
| 61 | 61 | Queue::fake(); |
| 62 | 62 | |
| 63 | - $export = Export::export( \App\Models\User::select([ 'name', 'email', 'created_at' ]), 'xls' ); |
|
| 63 | + $export = Export::export(\App\Models\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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |