Skip to content

Commit 613f507

Browse files
viralsolaniStyleCIBot
authored andcommitted
Apply fixes from StyleCI
1 parent 7000b86 commit 613f507

File tree

6 files changed

+82
-87
lines changed

6 files changed

+82
-87
lines changed

app/Http/Controllers/Api/V1/PagesController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,13 @@ public function show(Page $page)
5757
*/
5858
public function store(Request $request)
5959
{
60-
6160
$validation = $this->validatePages($request);
6261
if ($validation->fails()) {
6362
return $this->throwValidation($validation->messages()->first());
6463
}
6564

66-
$page = $this->repository->create($request->all());
67-
65+
$page = $this->repository->create($request->all());
66+
6867
return new PagesResource($page);
6968
}
7069

app/Http/Controllers/Api/V1/UsersController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace App\Http\Controllers\Api\V1;
44

5-
use App\Http\Requests\Backend\Access\User\ManageUserRequest;
65
use App\Http\Resources\UserResource;
76
use App\Models\Access\User\User;
87
use App\Repositories\Backend\Access\User\UserRepository;

app/Http/Middleware/VerifyCsrfToken.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ class VerifyCsrfToken extends BaseVerifier
1212
* @var array
1313
*/
1414
protected $except = [
15-
'api/*'
15+
'api/*',
1616
];
1717
}

app/Repositories/Backend/Pages/PagesRepository.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,11 @@ public function create(array $input)
5757

5858
if ($page = Page::create($input)) {
5959
event(new PageCreated($page));
60-
60+
6161
return $page;
6262
}
6363

6464
throw new GeneralException(trans('exceptions.backend.pages.create_error'));
65-
66-
67-
6865
}
6966

7067
/**

database/factories/PageFactory.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
$newestPage = Page::orderBy('id', 'desc')->first();
1111

1212
return [
13-
'title' => $title,
14-
'page_slug' => str_slug($title),
15-
'description' => $faker->paragraph,
16-
'cannonical_link' => "http://localhost:8000/".str_slug($title),
17-
'created_by' => function () {
13+
'title' => $title,
14+
'page_slug' => str_slug($title),
15+
'description' => $faker->paragraph,
16+
'cannonical_link' => 'http://localhost:8000/'.str_slug($title),
17+
'created_by' => function () {
1818
return factory(User::class)->create()->id;
1919
},
2020
'status' => 1,
21-
'created_at' => Carbon\Carbon::now(),
22-
'updated_at' => Carbon\Carbon::now(),
21+
'created_at' => Carbon\Carbon::now(),
22+
'updated_at' => Carbon\Carbon::now(),
2323
];
2424
});

tests/Feature/Api/V1/PageTest.php

Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,26 @@
22

33
namespace Tests\Feature\Api\V1;
44

5-
use Tests\TestCase;
6-
use Illuminate\Foundation\Testing\WithFaker;
7-
use Illuminate\Foundation\Testing\RefreshDatabase;
8-
use Tests\BrowserKitTestCase;
95
use App\Models\Access\User\User;
10-
116
use App\Models\Page\Page;
12-
137
use JWTAuth;
8+
use Tests\TestCase;
149

1510
class PageTest extends TestCase
1611
{
17-
public $token='';
18-
public $headers='';
19-
public $user='';
12+
public $token = '';
13+
public $headers = '';
14+
public $user = '';
15+
2016
public function setUp()
2117
{
2218
parent::setUp();
2319
$this->user = User::find(1);
2420

2521
$this->token = JWTAuth::fromUser($this->user);
26-
$this->headers = ['Authorization' => "Bearer ".$this->token];
22+
$this->headers = ['Authorization' => 'Bearer '.$this->token];
2723
}
24+
2825
/**
2926
* A basic test example.
3027
*
@@ -36,40 +33,40 @@ public function testExample()
3633
}
3734

3835
/**
39-
* A basic test to get response form pages api
36+
* A basic test to get response form pages api.
4037
*
4138
* @return void
4239
*/
40+
4341
/** @test */
4442
public function Get_records_from_pages()
4543
{
46-
4744
$payload = [];
48-
$response = $this->json('GET', '/api/v1/pages',$payload, $this->headers);
45+
$response = $this->json('GET', '/api/v1/pages', $payload, $this->headers);
4946
$response
5047
->assertStatus(200)
5148
->assertJsonStructure([
52-
'data'=>[
49+
'data'=> [
5350
[
54-
"id",
55-
"title",
56-
"status_label",
57-
"status",
58-
"created_at",
59-
"created_by"
60-
]
51+
'id',
52+
'title',
53+
'status_label',
54+
'status',
55+
'created_at',
56+
'created_by',
57+
],
6158
],
6259
'links',
63-
'meta'
60+
'meta',
6461
]);
65-
6662
}
6763

6864
/**
69-
* A basic test to get response form pages api
65+
* A basic test to get response form pages api.
7066
*
7167
* @return void
7268
*/
69+
7370
/** @test */
7471
public function get_one_created_page_from_db()
7572
{
@@ -79,101 +76,104 @@ public function get_one_created_page_from_db()
7976
$response
8077
->assertStatus(200)
8178
->assertJson([
82-
"data"=>[
83-
"id" => $page->id,
84-
"title" => $page->title,
85-
"status_label" => $page->status_label,
86-
"status" => ($page->isActive()) ? 'Active' :'InActive',
87-
"created_by" => $page->created_by,
79+
'data'=> [
80+
'id' => $page->id,
81+
'title' => $page->title,
82+
'status_label' => $page->status_label,
83+
'status' => ($page->isActive()) ? 'Active' : 'InActive',
84+
'created_by' => $page->created_by,
8885
],
8986
]);
90-
9187
}
88+
9289
/**
9390
* Author: Indra Shastri
9491
* Date:03-03-2018
95-
* A basic test to update a page from api
96-
*
92+
* A basic test to update a page from api.
93+
*
9794
*
9895
* @return void
9996
*/
97+
10098
/** @test */
10199
public function update_a_page_in_db_and_get_response()
102100
{
103101
$page = make(Page::class);
104102
$payload = [
105-
"title" => $page->title,
106-
"description" => $page->description,
107-
"cannonical_link" => $page->cannonical_link,
108-
"seo_title" => "some tittle",
109-
"seo_keyword" => "some keywords",
110-
"seo_description" => "<p>&nbsp;</p>↵<h1>SEO Description</h1>↵<p>some seco desctription</p>↵<p>askdsaj;ldsjfd</p>",
111-
"status" => "1",
103+
'title' => $page->title,
104+
'description' => $page->description,
105+
'cannonical_link' => $page->cannonical_link,
106+
'seo_title' => 'some tittle',
107+
'seo_keyword' => 'some keywords',
108+
'seo_description' => '<p>&nbsp;</p>↵<h1>SEO Description</h1>↵<p>some seco desctription</p>↵<p>askdsaj;ldsjfd</p>',
109+
'status' => '1',
112110
];
113-
$response = "";
111+
$response = '';
114112
$response = $this->json('PUT', '/api/v1/pages/1', $payload, $this->headers);
115-
113+
116114
$response->assertStatus(200);
117115
$response->assertJson([
118-
"data"=>[
119-
"title" => $page->title,
120-
"status_label" => $page->status_label,
121-
"status" => ($page->isActive()) ? 'Active' :'InActive',
122-
"created_by" => "".$this->user->id,
116+
'data'=> [
117+
'title' => $page->title,
118+
'status_label' => $page->status_label,
119+
'status' => ($page->isActive()) ? 'Active' : 'InActive',
120+
'created_by' => ''.$this->user->id,
123121
],
124122
]);
125-
126123
}
124+
127125
/**
128126
* Author: Indra Shastri
129127
* Date:03-03-2018
130-
* A basic test to create a page from api
128+
* A basic test to create a page from api.
131129
*
132130
* @return void
133131
*/
132+
134133
/** @test */
135134
public function create_a_new_page_in_db_and_get_response()
136135
{
137-
138136
$page = make(Page::class);
139137
$payload = [
140-
"title" => $page->title,
141-
"description" => $page->description,
142-
"cannonical_link" => $page->cannonical_link,
143-
"seo_title" => "some tittle",
144-
"seo_keyword" => "some keywords",
145-
"seo_description" => "<p>&nbsp;</p>↵<h1>SEO Description</h1>↵<p>some seco desctription</p>↵<p>askdsaj;ldsjfd</p>",
146-
"status" => "1",
138+
'title' => $page->title,
139+
'description' => $page->description,
140+
'cannonical_link' => $page->cannonical_link,
141+
'seo_title' => 'some tittle',
142+
'seo_keyword' => 'some keywords',
143+
'seo_description' => '<p>&nbsp;</p>↵<h1>SEO Description</h1>↵<p>some seco desctription</p>↵<p>askdsaj;ldsjfd</p>',
144+
'status' => '1',
147145
];
148-
$response = "";
146+
$response = '';
149147
$response = $this->json('POST', '/api/v1/pages', $payload, $this->headers);
150148
$response->assertStatus(201);
151149
$response->assertJson([
152-
"data" => [
153-
"title" => $page->title,
154-
"status_label" => $page->status_label,
155-
"status" => ($page->isActive()) ? 'Active' : 'InActive',
156-
"created_by" => $this->user->first_name,
157-
"created_at" => (\Carbon\Carbon::now())->toDateString()
150+
'data' => [
151+
'title' => $page->title,
152+
'status_label' => $page->status_label,
153+
'status' => ($page->isActive()) ? 'Active' : 'InActive',
154+
'created_by' => $this->user->first_name,
155+
'created_at' => (\Carbon\Carbon::now())->toDateString(),
158156
],
159-
]);
160-
157+
]);
161158
}
159+
162160
/**
163161
* Author: Indra Shastri
164162
* Date:03-03-2018
165-
* A basic test to create a page from api
163+
* A basic test to create a page from api.
166164
*
167165
* @return void
168166
*/
167+
169168
/** @test */
170-
public function delete_page_in_db_and_get_response(){
169+
public function delete_page_in_db_and_get_response()
170+
{
171171
$page = create(Page::class);
172-
$payload=[];
172+
$payload = [];
173173
$response = $this->json('DELETE', '/api/v1/pages/'.$page->id, $payload, $this->headers);
174174
$response->assertStatus(200)
175175
->assertJson([
176-
"message"=> "The Page was successfully deleted."
177-
]);
176+
'message'=> 'The Page was successfully deleted.',
177+
]);
178178
}
179179
}

0 commit comments

Comments
 (0)