Test Failed
Branch develop (5056e3)
by Abhishek Kumar
05:17
created
database/migrations/2018_06_25_112242_create_exports_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('exports', function (Blueprint $table) {
16
+        Schema::create('exports', function(Blueprint $table) {
17 17
             $table->increments('id');
18 18
             $table->string('file', 255)->nullable();
19 19
             $table->string('type', 10);
Please login to merge, or discard this patch.
database/migrations/2018_06_15_103302_create_imports_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('imports', function (Blueprint $table) {
16
+        Schema::create('imports', function(Blueprint $table) {
17 17
             $table->increments('id');
18 18
             $table->string('file', 255);
19 19
             $table->integer('file_rows');
Please login to merge, or discard this patch.
database/migrations/2018_06_22_045143_create_import_export_logs_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('import_export_logs', function (Blueprint $table) {
16
+        Schema::create('import_export_logs', function(Blueprint $table) {
17 17
             $table->increments('id');
18 18
             $table->integer('op_id');
19 19
             $table->longText('data');
Please login to merge, or discard this patch.
tests/ImportTest.php 2 patches
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -15,54 +15,54 @@  discard block
 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 setUp ()
23
-	{
24
-	    parent::setUp();
22
+    protected function setUp ()
23
+    {
24
+        parent::setUp();
25 25
 
26
-	    Route::middleware('web')->group(function() {
26
+        Route::middleware('web')->group(function() {
27 27
 
28
-		    Route::get('ticket/import', ['as' => 'ticket.import', 'uses' => 'Ladybirdweb\ImportExport\Import@showImportForm'] );
29
-		    Route::post('ticket/import', ['as' => 'ticket.import', 'uses' => 'Ladybirdweb\ImportExport\Import@uploadImportFile'] );
28
+            Route::get('ticket/import', ['as' => 'ticket.import', 'uses' => 'Ladybirdweb\ImportExport\Import@showImportForm'] );
29
+            Route::post('ticket/import', ['as' => 'ticket.import', 'uses' => 'Ladybirdweb\ImportExport\Import@uploadImportFile'] );
30 30
 
31
-			Route::get('/ticket/import/{id}/map', [ 'as' => 'ticket.import.show.map', 'uses' => 'Ladybirdweb\ImportExport\Import@showColumnsMapForm']);
32
-			Route::post('/ticket/import/{id}', [ 'as' => 'ticket.import.map', 'uses' => 'Ladybirdweb\ImportExport\Import@storeColumnsMap']);
31
+            Route::get('/ticket/import/{id}/map', [ 'as' => 'ticket.import.show.map', 'uses' => 'Ladybirdweb\ImportExport\Import@showColumnsMapForm']);
32
+            Route::post('/ticket/import/{id}', [ 'as' => 'ticket.import.map', 'uses' => 'Ladybirdweb\ImportExport\Import@storeColumnsMap']);
33 33
 
34
-			Route::get( '/import/{id}/progress', [ 'as' => 'ladybirdweb.import.ajax.progress', 'uses' => 'Ladybirdweb\ImportExport\Import@returnImportProgress']);
34
+            Route::get( '/import/{id}/progress', [ 'as' => 'ladybirdweb.import.ajax.progress', 'uses' => 'Ladybirdweb\ImportExport\Import@returnImportProgress']);
35 35
 
36
-		});
36
+        });
37 37
 
38
-		Storage::putFileAs('imports', new File( storage_path( 'test/test.csv' ) ), 'test.csv');
38
+        Storage::putFileAs('imports', new File( storage_path( 'test/test.csv' ) ), 'test.csv');
39 39
 
40
-		$this->import = ModelImport::create([
41
-			'file' => 'imports/test.csv',
42
-			'file_rows' => 104,
43
-			'db_cols' => [ 'name', 'email', 'password'],
44
-			'model_map' => ['email', 'name', 'password']
45
-		]);
46
-	}
40
+        $this->import = ModelImport::create([
41
+            'file' => 'imports/test.csv',
42
+            'file_rows' => 104,
43
+            'db_cols' => [ 'name', 'email', 'password'],
44
+            'model_map' => ['email', 'name', 'password']
45
+        ]);
46
+    }
47 47
 
48
-	/**
49
-	* @test
50
-	*/
51
-	public function see_import_form()
52
-	{
53
-		Import::setUploadRoute('ticket.import');
48
+    /**
49
+     * @test
50
+     */
51
+    public function see_import_form()
52
+    {
53
+        Import::setUploadRoute('ticket.import');
54 54
 
55
-		$response = $this->get('ticket/import');
55
+        $response = $this->get('ticket/import');
56 56
 
57
-		$response->assertSee( 'importer' );
58
-	}
57
+        $response->assertSee( 'importer' );
58
+    }
59 59
 
60
-	/**
61
-	* @test
62
-	*/
63
-	public function try_file_upload()
64
-	{
65
-		Storage::fake('file');
60
+    /**
61
+     * @test
62
+     */
63
+    public function try_file_upload()
64
+    {
65
+        Storage::fake('file');
66 66
 
67 67
         $response = $this->json( 'POST', '/ticket/import', [
68 68
             'file' => UploadedFile::fake()->create('file.csv', 100)
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
         $response->assertStatus(200);
72 72
 
73 73
         $response->assertJsonFragment( ['status' => 'ready'] );
74
-	}
74
+    }
75 75
 
76
-	/**
77
-	* @test
78
-	*/
79
-	public function fail_file_upload()
80
-	{
81
-		Storage::fake('file');
76
+    /**
77
+     * @test
78
+     */
79
+    public function fail_file_upload()
80
+    {
81
+        Storage::fake('file');
82 82
 
83 83
         $response = $this->json( 'POST', '/ticket/import', [
84 84
             'file' => UploadedFile::fake()->image('file.jpg')
@@ -89,81 +89,81 @@  discard block
 block discarded – undo
89 89
         $response->assertJsonFragment( ['status' => 'failed'] );
90 90
 
91 91
         $this->assertArrayHasKey( 'errors', Import::getImportErrors() );
92
-	}
92
+    }
93 93
 
94
-	/**
95
-	* @test
96
-	*/
97
-	public function map_data_with_csv_cols()
98
-	{
99
-		Import::setImportMapRoute('ticket.import.map');
94
+    /**
95
+     * @test
96
+     */
97
+    public function map_data_with_csv_cols()
98
+    {
99
+        Import::setImportMapRoute('ticket.import.map');
100 100
 
101
-		$id = $this->import->id;
101
+        $id = $this->import->id;
102 102
 
103
-		$response = $this->get('/ticket/import/' . $id . '/map');
103
+        $response = $this->get('/ticket/import/' . $id . '/map');
104 104
 
105
-		$response->assertStatus(200);
105
+        $response->assertStatus(200);
106 106
 
107
-		$response->assertSee( 'Confirm Import' );
108
-	}
107
+        $response->assertSee( 'Confirm Import' );
108
+    }
109 109
 
110
-	/**
111
-	* @test
112
-	*/
113
-	public function store_data_map_with_csv_cols()
114
-	{
115
-		$id = $this->import->id;
110
+    /**
111
+     * @test
112
+     */
113
+    public function store_data_map_with_csv_cols()
114
+    {
115
+        $id = $this->import->id;
116 116
 
117
-		$response = $this->post( '/ticket/import/' . $id, [
118
-			'db_column' => ['email', 'name', 'password']
119
-		] );
117
+        $response = $this->post( '/ticket/import/' . $id, [
118
+            'db_column' => ['email', 'name', 'password']
119
+        ] );
120 120
 
121
-		$response->assertStatus(200);
121
+        $response->assertStatus(200);
122 122
 
123
-		$response->assertSessionMissing( 'errors' );
124
-	}
123
+        $response->assertSessionMissing( 'errors' );
124
+    }
125 125
 
126
-	/**
127
-	* @test
128
-	*/
129
-	public function store_data_map_with_csv_cols_failed_validation()
130
-	{
131
-		$id = $this->import->id;
126
+    /**
127
+     * @test
128
+     */
129
+    public function store_data_map_with_csv_cols_failed_validation()
130
+    {
131
+        $id = $this->import->id;
132 132
 
133
-		$response = $this->post( '/ticket/import/' . $id, [
134
-			'db_column' => ['name', 'name', 'name']
135
-		] );
133
+        $response = $this->post( '/ticket/import/' . $id, [
134
+            'db_column' => ['name', 'name', 'name']
135
+        ] );
136 136
 
137
-		$response->assertStatus(302);
137
+        $response->assertStatus(302);
138 138
 
139
-		$response->assertSessionHas( 'errors' );
140
-	}
139
+        $response->assertSessionHas( 'errors' );
140
+    }
141 141
 
142
-	/**
143
-	* @test
144
-	*/
145
-	public function sucess_to_dispatch_given_job_class()
146
-	{
147
-		$import = $id = $this->import;
142
+    /**
143
+     * @test
144
+     */
145
+    public function sucess_to_dispatch_given_job_class()
146
+    {
147
+        $import = $id = $this->import;
148 148
 
149
-		Queue::fake();
149
+        Queue::fake();
150 150
 
151
-		Import::dispatchImportJob( FakeJob::class, $import );
151
+        Import::dispatchImportJob( FakeJob::class, $import );
152 152
 
153
-		Queue::assertPushedOn('importing', FakeJob::class);
154
-	}
153
+        Queue::assertPushedOn('importing', FakeJob::class);
154
+    }
155 155
 
156
-	/**
157
-	* @test
158
-	*/
159
-	public function check_import_progress()
160
-	{
161
-		$response = $this->json( 'GET', '/import/1/progress' );
156
+    /**
157
+     * @test
158
+     */
159
+    public function check_import_progress()
160
+    {
161
+        $response = $this->json( 'GET', '/import/1/progress' );
162 162
 
163
-		$response->assertStatus(200);
163
+        $response->assertStatus(200);
164 164
 
165
-		$response->assertJsonFragment( ['status' => 200] );
165
+        $response->assertJsonFragment( ['status' => 200] );
166 166
 
167
-		$response->assertJsonFragment( ['progress'] );
168
-	}
167
+        $response->assertJsonFragment( ['progress'] );
168
+    }
169 169
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -19,28 +19,28 @@  discard block
 block discarded – undo
19 19
 
20 20
 	protected $import;
21 21
 
22
-	protected function setUp ()
22
+	protected function setUp()
23 23
 	{
24 24
 	    parent::setUp();
25 25
 
26 26
 	    Route::middleware('web')->group(function() {
27 27
 
28
-		    Route::get('ticket/import', ['as' => 'ticket.import', 'uses' => 'Ladybirdweb\ImportExport\Import@showImportForm'] );
29
-		    Route::post('ticket/import', ['as' => 'ticket.import', 'uses' => 'Ladybirdweb\ImportExport\Import@uploadImportFile'] );
28
+		    Route::get('ticket/import', ['as' => 'ticket.import', 'uses' => 'Ladybirdweb\ImportExport\Import@showImportForm']);
29
+		    Route::post('ticket/import', ['as' => 'ticket.import', 'uses' => 'Ladybirdweb\ImportExport\Import@uploadImportFile']);
30 30
 
31
-			Route::get('/ticket/import/{id}/map', [ 'as' => 'ticket.import.show.map', 'uses' => 'Ladybirdweb\ImportExport\Import@showColumnsMapForm']);
32
-			Route::post('/ticket/import/{id}', [ 'as' => 'ticket.import.map', 'uses' => 'Ladybirdweb\ImportExport\Import@storeColumnsMap']);
31
+			Route::get('/ticket/import/{id}/map', ['as' => 'ticket.import.show.map', 'uses' => 'Ladybirdweb\ImportExport\Import@showColumnsMapForm']);
32
+			Route::post('/ticket/import/{id}', ['as' => 'ticket.import.map', 'uses' => 'Ladybirdweb\ImportExport\Import@storeColumnsMap']);
33 33
 
34
-			Route::get( '/import/{id}/progress', [ 'as' => 'ladybirdweb.import.ajax.progress', 'uses' => 'Ladybirdweb\ImportExport\Import@returnImportProgress']);
34
+			Route::get('/import/{id}/progress', ['as' => 'ladybirdweb.import.ajax.progress', 'uses' => 'Ladybirdweb\ImportExport\Import@returnImportProgress']);
35 35
 
36 36
 		});
37 37
 
38
-		Storage::putFileAs('imports', new File( storage_path( 'test/test.csv' ) ), 'test.csv');
38
+		Storage::putFileAs('imports', new File(storage_path('test/test.csv')), 'test.csv');
39 39
 
40 40
 		$this->import = ModelImport::create([
41 41
 			'file' => 'imports/test.csv',
42 42
 			'file_rows' => 104,
43
-			'db_cols' => [ 'name', 'email', 'password'],
43
+			'db_cols' => ['name', 'email', 'password'],
44 44
 			'model_map' => ['email', 'name', 'password']
45 45
 		]);
46 46
 	}
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 		$response = $this->get('ticket/import');
56 56
 
57
-		$response->assertSee( 'importer' );
57
+		$response->assertSee('importer');
58 58
 	}
59 59
 
60 60
 	/**
@@ -64,13 +64,13 @@  discard block
 block discarded – undo
64 64
 	{
65 65
 		Storage::fake('file');
66 66
 
67
-        $response = $this->json( 'POST', '/ticket/import', [
67
+        $response = $this->json('POST', '/ticket/import', [
68 68
             'file' => UploadedFile::fake()->create('file.csv', 100)
69 69
         ]);
70 70
 
71 71
         $response->assertStatus(200);
72 72
 
73
-        $response->assertJsonFragment( ['status' => 'ready'] );
73
+        $response->assertJsonFragment(['status' => 'ready']);
74 74
 	}
75 75
 
76 76
 	/**
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
 	{
81 81
 		Storage::fake('file');
82 82
 
83
-        $response = $this->json( 'POST', '/ticket/import', [
83
+        $response = $this->json('POST', '/ticket/import', [
84 84
             'file' => UploadedFile::fake()->image('file.jpg')
85 85
         ]);
86 86
 
87 87
         $response->assertStatus(200);
88 88
 
89
-        $response->assertJsonFragment( ['status' => 'failed'] );
89
+        $response->assertJsonFragment(['status' => 'failed']);
90 90
 
91
-        $this->assertArrayHasKey( 'errors', Import::getImportErrors() );
91
+        $this->assertArrayHasKey('errors', Import::getImportErrors());
92 92
 	}
93 93
 
94 94
 	/**
@@ -100,11 +100,11 @@  discard block
 block discarded – undo
100 100
 
101 101
 		$id = $this->import->id;
102 102
 
103
-		$response = $this->get('/ticket/import/' . $id . '/map');
103
+		$response = $this->get('/ticket/import/'.$id.'/map');
104 104
 
105 105
 		$response->assertStatus(200);
106 106
 
107
-		$response->assertSee( 'Confirm Import' );
107
+		$response->assertSee('Confirm Import');
108 108
 	}
109 109
 
110 110
 	/**
@@ -114,13 +114,13 @@  discard block
 block discarded – undo
114 114
 	{
115 115
 		$id = $this->import->id;
116 116
 
117
-		$response = $this->post( '/ticket/import/' . $id, [
117
+		$response = $this->post('/ticket/import/'.$id, [
118 118
 			'db_column' => ['email', 'name', 'password']
119
-		] );
119
+		]);
120 120
 
121 121
 		$response->assertStatus(200);
122 122
 
123
-		$response->assertSessionMissing( 'errors' );
123
+		$response->assertSessionMissing('errors');
124 124
 	}
125 125
 
126 126
 	/**
@@ -130,13 +130,13 @@  discard block
 block discarded – undo
130 130
 	{
131 131
 		$id = $this->import->id;
132 132
 
133
-		$response = $this->post( '/ticket/import/' . $id, [
133
+		$response = $this->post('/ticket/import/'.$id, [
134 134
 			'db_column' => ['name', 'name', 'name']
135
-		] );
135
+		]);
136 136
 
137 137
 		$response->assertStatus(302);
138 138
 
139
-		$response->assertSessionHas( 'errors' );
139
+		$response->assertSessionHas('errors');
140 140
 	}
141 141
 
142 142
 	/**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
 		Queue::fake();
150 150
 
151
-		Import::dispatchImportJob( FakeJob::class, $import );
151
+		Import::dispatchImportJob(FakeJob::class, $import);
152 152
 
153 153
 		Queue::assertPushedOn('importing', FakeJob::class);
154 154
 	}
@@ -158,12 +158,12 @@  discard block
 block discarded – undo
158 158
 	*/
159 159
 	public function check_import_progress()
160 160
 	{
161
-		$response = $this->json( 'GET', '/import/1/progress' );
161
+		$response = $this->json('GET', '/import/1/progress');
162 162
 
163 163
 		$response->assertStatus(200);
164 164
 
165
-		$response->assertJsonFragment( ['status' => 200] );
165
+		$response->assertJsonFragment(['status' => 200]);
166 166
 
167
-		$response->assertJsonFragment( ['progress'] );
167
+		$response->assertJsonFragment(['progress']);
168 168
 	}
169 169
 }
Please login to merge, or discard this patch.
tests/ExportTest.php 2 patches
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -16,90 +16,90 @@
 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 setUp ()
24
-	{
25
-	    parent::setUp();
23
+    protected function setUp ()
24
+    {
25
+        parent::setUp();
26 26
 
27
-	    Route::middleware('web')->group(function() {
27
+        Route::middleware('web')->group(function() {
28 28
 
29
-			Route::get('/ticket/export/{id}', [ 'as' => 'ticket.export.progress', 'uses' => 'Ladybirdweb\ImportExport\Export@showExportStatus']);
29
+            Route::get('/ticket/export/{id}', [ 'as' => 'ticket.export.progress', 'uses' => 'Ladybirdweb\ImportExport\Export@showExportStatus']);
30 30
 
31
-			Route::get( '/export/{id}/download',  [ 'as' => 'ladybirdweb.export.download', 'uses' => 'Ladybirdweb\ImportExport\Export@downloadExportedFile']);
31
+            Route::get( '/export/{id}/download',  [ 'as' => 'ladybirdweb.export.download', 'uses' => 'Ladybirdweb\ImportExport\Export@downloadExportedFile']);
32 32
 
33
-		});
33
+        });
34 34
 
35
-		Storage::putFileAs('exports', new File( storage_path( 'test/test.csv' ) ), 'test.xls');
35
+        Storage::putFileAs('exports', new File( storage_path( 'test/test.csv' ) ), 'test.xls');
36 36
 
37
-		$this->export = ModelExport::create([
38
-			'file' => 'test.xls',
39
-			'query' => \App\Models\User::select([ 'name', 'email', 'created_at' ])->getModel(),
40
-			'type' => 'xls'
41
-		]);
42
-	}
37
+        $this->export = ModelExport::create([
38
+            'file' => 'test.xls',
39
+            'query' => \App\Models\User::select([ 'name', 'email', 'created_at' ])->getModel(),
40
+            'type' => 'xls'
41
+        ]);
42
+    }
43 43
 
44
-	/**
45
-	* @test
46
-	*/
47
-	public function data_export_initiated_and_dispatched()
48
-	{
49
-		Queue::fake();
44
+    /**
45
+     * @test
46
+     */
47
+    public function data_export_initiated_and_dispatched()
48
+    {
49
+        Queue::fake();
50 50
 
51
-		$export = Export::export( \App\Models\User::select([ 'name', 'email', 'created_at' ]), 'xls' );
51
+        $export = Export::export( \App\Models\User::select([ 'name', 'email', 'created_at' ]), 'xls' );
52 52
 
53
-		$this->assertInstanceOf( ModelExport::class, $export );
53
+        $this->assertInstanceOf( ModelExport::class, $export );
54 54
 
55
-		Queue::assertPushedOn('exporting', ExportJob::class);
56
-	}
55
+        Queue::assertPushedOn('exporting', ExportJob::class);
56
+    }
57 57
 
58
-	/**
59
-	* @test
60
-	*/
61
-	public function see_export_progress_page()
62
-	{
63
-		$response =  $this->get('/ticket/export/' . $this->export->id);
58
+    /**
59
+     * @test
60
+     */
61
+    public function see_export_progress_page()
62
+    {
63
+        $response =  $this->get('/ticket/export/' . $this->export->id);
64 64
 
65
-		$response->assertStatus(200);
65
+        $response->assertStatus(200);
66 66
 
67
-		$response->assertSee('Export');
68
-	}
67
+        $response->assertSee('Export');
68
+    }
69 69
 
70
-	/**
71
-	* @test
72
-	*/
73
-	public function check_export_progress_ajax()
74
-	{
75
-		$response = $this->json( 'GET', '/export/' . $this->export->id . '/progress');
70
+    /**
71
+     * @test
72
+     */
73
+    public function check_export_progress_ajax()
74
+    {
75
+        $response = $this->json( 'GET', '/export/' . $this->export->id . '/progress');
76 76
 
77
-		$response->assertStatus(200);
77
+        $response->assertStatus(200);
78 78
 
79
-		$response->assertJsonFragment( ['status' => 200] );
79
+        $response->assertJsonFragment( ['status' => 200] );
80 80
 
81
-		$response->assertJsonFragment( ['progress'] );
82
-	}
81
+        $response->assertJsonFragment( ['progress'] );
82
+    }
83 83
 
84
-	/**
85
-	* @test
86
-	*/
87
-	public function try_download_exported_file()
88
-	{
89
-		$response = $this->get('/export/' . $this->export->id . '/download');
84
+    /**
85
+     * @test
86
+     */
87
+    public function try_download_exported_file()
88
+    {
89
+        $response = $this->get('/export/' . $this->export->id . '/download');
90 90
 
91
-		$response->assertHeader( 'content-disposition', 'attachment; filename="test.xls"');
91
+        $response->assertHeader( 'content-disposition', 'attachment; filename="test.xls"');
92 92
 
93
-		$response->assertStatus(200);
94
-	}
93
+        $response->assertStatus(200);
94
+    }
95 95
 
96
-	/**
97
-	* @test
98
-	*/
99
-	public function fail_download_exported_file()
100
-	{
101
-		$response = $this->get('/export/' . rand(1, 100) . '/download');
96
+    /**
97
+     * @test
98
+     */
99
+    public function fail_download_exported_file()
100
+    {
101
+        $response = $this->get('/export/' . rand(1, 100) . '/download');
102 102
 
103
-		$response->assertStatus(404);
104
-	}
103
+        $response->assertStatus(404);
104
+    }
105 105
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -20,23 +20,23 @@  discard block
 block discarded – undo
20 20
 
21 21
 	protected $export;
22 22
 
23
-	protected function setUp ()
23
+	protected function setUp()
24 24
 	{
25 25
 	    parent::setUp();
26 26
 
27 27
 	    Route::middleware('web')->group(function() {
28 28
 
29
-			Route::get('/ticket/export/{id}', [ 'as' => 'ticket.export.progress', 'uses' => 'Ladybirdweb\ImportExport\Export@showExportStatus']);
29
+			Route::get('/ticket/export/{id}', ['as' => 'ticket.export.progress', 'uses' => 'Ladybirdweb\ImportExport\Export@showExportStatus']);
30 30
 
31
-			Route::get( '/export/{id}/download',  [ 'as' => 'ladybirdweb.export.download', 'uses' => 'Ladybirdweb\ImportExport\Export@downloadExportedFile']);
31
+			Route::get('/export/{id}/download', ['as' => 'ladybirdweb.export.download', 'uses' => 'Ladybirdweb\ImportExport\Export@downloadExportedFile']);
32 32
 
33 33
 		});
34 34
 
35
-		Storage::putFileAs('exports', new File( storage_path( 'test/test.csv' ) ), 'test.xls');
35
+		Storage::putFileAs('exports', new File(storage_path('test/test.csv')), 'test.xls');
36 36
 
37 37
 		$this->export = ModelExport::create([
38 38
 			'file' => 'test.xls',
39
-			'query' => \App\Models\User::select([ 'name', 'email', 'created_at' ])->getModel(),
39
+			'query' => \App\Models\User::select(['name', 'email', 'created_at'])->getModel(),
40 40
 			'type' => 'xls'
41 41
 		]);
42 42
 	}
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	{
49 49
 		Queue::fake();
50 50
 
51
-		$export = Export::export( \App\Models\User::select([ 'name', 'email', 'created_at' ]), 'xls' );
51
+		$export = Export::export(\App\Models\User::select(['name', 'email', 'created_at']), 'xls');
52 52
 
53
-		$this->assertInstanceOf( ModelExport::class, $export );
53
+		$this->assertInstanceOf(ModelExport::class, $export);
54 54
 
55 55
 		Queue::assertPushedOn('exporting', ExportJob::class);
56 56
 	}
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	*/
61 61
 	public function see_export_progress_page()
62 62
 	{
63
-		$response =  $this->get('/ticket/export/' . $this->export->id);
63
+		$response = $this->get('/ticket/export/'.$this->export->id);
64 64
 
65 65
 		$response->assertStatus(200);
66 66
 
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
 	*/
73 73
 	public function check_export_progress_ajax()
74 74
 	{
75
-		$response = $this->json( 'GET', '/export/' . $this->export->id . '/progress');
75
+		$response = $this->json('GET', '/export/'.$this->export->id.'/progress');
76 76
 
77 77
 		$response->assertStatus(200);
78 78
 
79
-		$response->assertJsonFragment( ['status' => 200] );
79
+		$response->assertJsonFragment(['status' => 200]);
80 80
 
81
-		$response->assertJsonFragment( ['progress'] );
81
+		$response->assertJsonFragment(['progress']);
82 82
 	}
83 83
 
84 84
 	/**
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 	*/
87 87
 	public function try_download_exported_file()
88 88
 	{
89
-		$response = $this->get('/export/' . $this->export->id . '/download');
89
+		$response = $this->get('/export/'.$this->export->id.'/download');
90 90
 
91
-		$response->assertHeader( 'content-disposition', 'attachment; filename="test.xls"');
91
+		$response->assertHeader('content-disposition', 'attachment; filename="test.xls"');
92 92
 
93 93
 		$response->assertStatus(200);
94 94
 	}
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	*/
99 99
 	public function fail_download_exported_file()
100 100
 	{
101
-		$response = $this->get('/export/' . rand(1, 100) . '/download');
101
+		$response = $this->get('/export/'.rand(1, 100).'/download');
102 102
 
103 103
 		$response->assertStatus(404);
104 104
 	}
Please login to merge, or discard this patch.
tests/ImportExportLogTest.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -11,49 +11,49 @@
 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 setUp ()
19
-	{
20
-	    parent::setUp();
18
+    protected function setUp ()
19
+    {
20
+        parent::setUp();
21 21
 
22
-		$this->import = Import::create([
23
-			'file' => 'imports/import-1530262997.csv',
24
-			'file_rows' => 104,
25
-			'db_cols' => [ 'name', 'email', 'password'],
26
-			'model_map' => ['email', 'name', 'password']
27
-		]);
28
-	}
22
+        $this->import = Import::create([
23
+            'file' => 'imports/import-1530262997.csv',
24
+            'file_rows' => 104,
25
+            'db_cols' => [ 'name', 'email', 'password'],
26
+            'model_map' => ['email', 'name', 'password']
27
+        ]);
28
+    }
29 29
 
30
-	/**
31
-	* @test
32
-	*/
33
-	public function save_new_log()
34
-	{
35
-		$import = $this->import;
30
+    /**
31
+     * @test
32
+     */
33
+    public function save_new_log()
34
+    {
35
+        $import = $this->import;
36 36
 
37
-		$result = ImportExportLog::logImportError( $import, ['data' => 'this is test data'], 'This is not expected' );
37
+        $result = ImportExportLog::logImportError( $import, ['data' => 'this is test data'], 'This is not expected' );
38 38
 
39
-		$this->assertInstanceOf( ModelImportExportLog::class, $result );
40
-	}
39
+        $this->assertInstanceOf( ModelImportExportLog::class, $result );
40
+    }
41 41
 
42
-	/**
43
-	* @test
44
-	*/
45
-	public function get_saved_logs()
46
-	{
47
-		$import = $this->import;
42
+    /**
43
+     * @test
44
+     */
45
+    public function get_saved_logs()
46
+    {
47
+        $import = $this->import;
48 48
 
49
-		$log = ImportExportLog::logImportError( $import, ['data' => 'this is test data'], 'This is not expected' );
49
+        $log = ImportExportLog::logImportError( $import, ['data' => 'this is test data'], 'This is not expected' );
50 50
 
51
-		$log_in_db = ImportExportLog::getLogs( $log->id );
51
+        $log_in_db = ImportExportLog::getLogs( $log->id );
52 52
 
53
-		$this->assertInternalType( 'array', $log_in_db );
53
+        $this->assertInternalType( 'array', $log_in_db );
54 54
 
55
-		$this->assertArrayHasKey( 'data', $log_in_db[0] );
55
+        $this->assertArrayHasKey( 'data', $log_in_db[0] );
56 56
 
57
-		$this->assertArrayHasKey( 'message', $log_in_db[0] );
58
-	}
57
+        $this->assertArrayHasKey( 'message', $log_in_db[0] );
58
+    }
59 59
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@  discard block
 block discarded – undo
15 15
 
16 16
 	protected $import;
17 17
 
18
-	protected function setUp ()
18
+	protected function setUp()
19 19
 	{
20 20
 	    parent::setUp();
21 21
 
22 22
 		$this->import = Import::create([
23 23
 			'file' => 'imports/import-1530262997.csv',
24 24
 			'file_rows' => 104,
25
-			'db_cols' => [ 'name', 'email', 'password'],
25
+			'db_cols' => ['name', 'email', 'password'],
26 26
 			'model_map' => ['email', 'name', 'password']
27 27
 		]);
28 28
 	}
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 	{
35 35
 		$import = $this->import;
36 36
 
37
-		$result = ImportExportLog::logImportError( $import, ['data' => 'this is test data'], 'This is not expected' );
37
+		$result = ImportExportLog::logImportError($import, ['data' => 'this is test data'], 'This is not expected');
38 38
 
39
-		$this->assertInstanceOf( ModelImportExportLog::class, $result );
39
+		$this->assertInstanceOf(ModelImportExportLog::class, $result);
40 40
 	}
41 41
 
42 42
 	/**
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
 	{
47 47
 		$import = $this->import;
48 48
 
49
-		$log = ImportExportLog::logImportError( $import, ['data' => 'this is test data'], 'This is not expected' );
49
+		$log = ImportExportLog::logImportError($import, ['data' => 'this is test data'], 'This is not expected');
50 50
 
51
-		$log_in_db = ImportExportLog::getLogs( $log->id );
51
+		$log_in_db = ImportExportLog::getLogs($log->id);
52 52
 
53
-		$this->assertInternalType( 'array', $log_in_db );
53
+		$this->assertInternalType('array', $log_in_db);
54 54
 
55
-		$this->assertArrayHasKey( 'data', $log_in_db[0] );
55
+		$this->assertArrayHasKey('data', $log_in_db[0]);
56 56
 
57
-		$this->assertArrayHasKey( 'message', $log_in_db[0] );
57
+		$this->assertArrayHasKey('message', $log_in_db[0]);
58 58
 	}
59 59
 }
Please login to merge, or discard this patch.
src/Models/ImportExportLog.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -10,23 +10,23 @@  discard block
 block discarded – undo
10 10
 
11 11
 
12 12
     /**
13
-    * Relationship with import model
14
-    *
15
-    * @return void
16
-    */
13
+     * Relationship with import model
14
+     *
15
+     * @return void
16
+     */
17 17
     public function import()
18 18
     {
19
-    	return $this->belongsTo( \Ladybirdweb\ImportExport\Models\Import::class );
19
+        return $this->belongsTo( \Ladybirdweb\ImportExport\Models\Import::class );
20 20
     }
21 21
 
22 22
 
23 23
     /**
24
-    * Model Map accessor
25
-    *
26
-    * Unserialize data while retriving.
27
-    * @param $value
28
-    * @return string
29
-    */
24
+     * Model Map accessor
25
+     *
26
+     * Unserialize data while retriving.
27
+     * @param $value
28
+     * @return string
29
+     */
30 30
     public function getDataAttribute($value)
31 31
     {
32 32
         return unserialize( $value );
@@ -34,12 +34,12 @@  discard block
 block discarded – undo
34 34
 
35 35
 
36 36
     /**
37
-    * Model Map mulator
38
-    *
39
-    * Serialize data while storing.
40
-    * @param $value
41
-    * @return void
42
-    */
37
+     * Model Map mulator
38
+     *
39
+     * Serialize data while storing.
40
+     * @param $value
41
+     * @return void
42
+     */
43 43
     public function setDataAttribute($value)
44 44
     {
45 45
         $this->attributes['data'] = serialize( $value );
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 
48 48
 
49 49
     /**
50
-    * Model Map accessor
51
-    *
52
-    * Unserialize message while retriving.
53
-    * @param $value
54
-    * @return string
55
-    */
50
+     * Model Map accessor
51
+     *
52
+     * Unserialize message while retriving.
53
+     * @param $value
54
+     * @return string
55
+     */
56 56
     public function getMessageAttribute($value)
57 57
     {
58 58
         return unserialize( $value );
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 
61 61
 
62 62
     /**
63
-    * Model Map mulator
64
-    *
65
-    * Serialize message while storing.
66
-    * @param $value
67
-    * @return void
68
-    */
63
+     * Model Map mulator
64
+     *
65
+     * Serialize message while storing.
66
+     * @param $value
67
+     * @return void
68
+     */
69 69
     public function setMessageAttribute($value)
70 70
     {
71 71
         $this->attributes['message'] = serialize( $value );
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     */
17 17
     public function import()
18 18
     {
19
-    	return $this->belongsTo( \Ladybirdweb\ImportExport\Models\Import::class );
19
+    	return $this->belongsTo(\Ladybirdweb\ImportExport\Models\Import::class);
20 20
     }
21 21
 
22 22
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     */
30 30
     public function getDataAttribute($value)
31 31
     {
32
-        return unserialize( $value );
32
+        return unserialize($value);
33 33
     }
34 34
 
35 35
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     */
43 43
     public function setDataAttribute($value)
44 44
     {
45
-        $this->attributes['data'] = serialize( $value );
45
+        $this->attributes['data'] = serialize($value);
46 46
     }
47 47
 
48 48
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     */
56 56
     public function getMessageAttribute($value)
57 57
     {
58
-        return unserialize( $value );
58
+        return unserialize($value);
59 59
     }
60 60
 
61 61
 
@@ -68,6 +68,6 @@  discard block
 block discarded – undo
68 68
     */
69 69
     public function setMessageAttribute($value)
70 70
     {
71
-        $this->attributes['message'] = serialize( $value );
71
+        $this->attributes['message'] = serialize($value);
72 72
     }
73 73
 }
Please login to merge, or discard this patch.
src/Models/Export.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -9,12 +9,12 @@  discard block
 block discarded – undo
9 9
     protected $fillable = [ 'file', 'type', 'query', 'result_rows'];
10 10
 
11 11
     /**
12
-    * Query accessor
13
-    *
14
-    * Unserialize query while retriving.
15
-    * @param $value
16
-    * @return string
17
-    */
12
+     * Query accessor
13
+     *
14
+     * Unserialize query while retriving.
15
+     * @param $value
16
+     * @return string
17
+     */
18 18
     public function getQueryAttribute($value)
19 19
     {
20 20
         return unserialize( $value );
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
 
23 23
 
24 24
     /**
25
-    * Query mulator
26
-    *
27
-    * Serialize query while storing.
28
-    * @param $value
29
-    * @return void
30
-    */
25
+     * Query mulator
26
+     *
27
+     * Serialize query while storing.
28
+     * @param $value
29
+     * @return void
30
+     */
31 31
     public function setQueryAttribute($value)
32 32
     {
33 33
         $this->attributes['query'] = serialize( $value );
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 
7 7
 class Export extends Model
8 8
 {
9
-    protected $fillable = [ 'file', 'type', 'query', 'result_rows'];
9
+    protected $fillable = ['file', 'type', 'query', 'result_rows'];
10 10
 
11 11
     /**
12 12
     * Query accessor
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     */
18 18
     public function getQueryAttribute($value)
19 19
     {
20
-        return unserialize( $value );
20
+        return unserialize($value);
21 21
     }
22 22
 
23 23
 
@@ -30,6 +30,6 @@  discard block
 block discarded – undo
30 30
     */
31 31
     public function setQueryAttribute($value)
32 32
     {
33
-        $this->attributes['query'] = serialize( $value );
33
+        $this->attributes['query'] = serialize($value);
34 34
     }
35 35
 }
Please login to merge, or discard this patch.
src/Models/Import.php 2 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -6,27 +6,27 @@  discard block
 block discarded – undo
6 6
 
7 7
 class Import extends Model
8 8
 {
9
-	protected $fillable = ['file', 'file_rows', 'db_cols', 'row_processed'];
9
+    protected $fillable = ['file', 'file_rows', 'db_cols', 'row_processed'];
10 10
 
11 11
 
12 12
     /**
13
-    * Relationship with import export log model
14
-    *
15
-    * @return void
16
-    */
13
+     * Relationship with import export log model
14
+     *
15
+     * @return void
16
+     */
17 17
     public function importLogs()
18 18
     {
19
-    	return $this->hasMany( \Ladybirdweb\ImportExport\Models\ImportExportLog::class, 'op_id' );
19
+        return $this->hasMany( \Ladybirdweb\ImportExport\Models\ImportExportLog::class, 'op_id' );
20 20
     }
21 21
 
22 22
 
23 23
     /**
24
-    * Model Map accessor
25
-    *
26
-    * Unserialize model map while retriving.
27
-    * @param $value
28
-    * @return string
29
-    */
24
+     * Model Map accessor
25
+     *
26
+     * Unserialize model map while retriving.
27
+     * @param $value
28
+     * @return string
29
+     */
30 30
     public function getModelMapAttribute($value)
31 31
     {
32 32
         return unserialize( $value );
@@ -34,12 +34,12 @@  discard block
 block discarded – undo
34 34
 
35 35
 
36 36
     /**
37
-    * Model Map mulator
38
-    *
39
-    * Serialize model map while storing.
40
-    * @param $value
41
-    * @return void
42
-    */
37
+     * Model Map mulator
38
+     *
39
+     * Serialize model map while storing.
40
+     * @param $value
41
+     * @return void
42
+     */
43 43
     public function setModelMapAttribute($value)
44 44
     {
45 45
         $this->attributes['model_map'] = serialize( $value );
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 
48 48
 
49 49
     /**
50
-    * DB cols accessor
51
-    *
52
-    * Unserialize model map while retriving.
53
-    * @param $value
54
-    * @return string
55
-    */
50
+     * DB cols accessor
51
+     *
52
+     * Unserialize model map while retriving.
53
+     * @param $value
54
+     * @return string
55
+     */
56 56
     public function getDbColsAttribute($value)
57 57
     {
58 58
         return unserialize( $value );
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 
61 61
 
62 62
     /**
63
-    * Model Map mulator
64
-    *
65
-    * Serialize model map while storing.
66
-    * @param $value
67
-    * @return void
68
-    */
63
+     * Model Map mulator
64
+     *
65
+     * Serialize model map while storing.
66
+     * @param $value
67
+     * @return void
68
+     */
69 69
     public function setDbColsAttribute($value)
70 70
     {
71 71
         $this->attributes['db_cols'] = serialize( $value );
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     */
17 17
     public function importLogs()
18 18
     {
19
-    	return $this->hasMany( \Ladybirdweb\ImportExport\Models\ImportExportLog::class, 'op_id' );
19
+    	return $this->hasMany(\Ladybirdweb\ImportExport\Models\ImportExportLog::class, 'op_id');
20 20
     }
21 21
 
22 22
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     */
30 30
     public function getModelMapAttribute($value)
31 31
     {
32
-        return unserialize( $value );
32
+        return unserialize($value);
33 33
     }
34 34
 
35 35
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     */
43 43
     public function setModelMapAttribute($value)
44 44
     {
45
-        $this->attributes['model_map'] = serialize( $value );
45
+        $this->attributes['model_map'] = serialize($value);
46 46
     }
47 47
 
48 48
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     */
56 56
     public function getDbColsAttribute($value)
57 57
     {
58
-        return unserialize( $value );
58
+        return unserialize($value);
59 59
     }
60 60
 
61 61
 
@@ -68,6 +68,6 @@  discard block
 block discarded – undo
68 68
     */
69 69
     public function setDbColsAttribute($value)
70 70
     {
71
-        $this->attributes['db_cols'] = serialize( $value );
71
+        $this->attributes['db_cols'] = serialize($value);
72 72
     }
73 73
 }
Please login to merge, or discard this patch.