Skip to content

Commit 4321b87

Browse files
committed
Run php-cs-fixer on package
1 parent e7e4409 commit 4321b87

File tree

4 files changed

+3
-58
lines changed

4 files changed

+3
-58
lines changed

src/Database/Table.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
*/
1313
class Table
1414
{
15-
1615
/**
1716
* The database table instance.
1817
*
19-
* @var array
18+
* @var \Doctrine\DBAL\Schema\Table
2019
*/
2120
public $table;
2221

@@ -42,7 +41,6 @@ class Table
4241
*/
4342
public function __construct($context, $name)
4443
{
45-
4644
$this->context = $context;
4745
$this->name = $name;
4846
}
@@ -55,7 +53,6 @@ public function __construct($context, $name)
5553
*/
5654
public function column($column)
5755
{
58-
5956
return $this->tableColumn($column)->exists();
6057
}
6158

@@ -66,7 +63,6 @@ public function column($column)
6663
*/
6764
public function exists()
6865
{
69-
7066
$this->context->assertTrue(Schema::hasTable($this->name), "The table {$this->name} does not exist.");
7167

7268
return $this;
@@ -79,9 +75,7 @@ public function exists()
7975
*/
8076
public function getName()
8177
{
82-
8378
return $this->table->getName();
84-
8579
}
8680

8781
/**
@@ -91,7 +85,6 @@ public function getName()
9185
*/
9286
public function hasTimestamps()
9387
{
94-
9588
$this->column('created_at')->dateTime()->nullable();
9689
$this->column('updated_at')->dateTime()->nullable();
9790

@@ -106,7 +99,6 @@ public function hasTimestamps()
10699
*/
107100
protected function tableColumn($column)
108101
{
109-
110102
if (is_null($this->table)) {
111103
$this->setTable();
112104
}
@@ -119,7 +111,6 @@ protected function tableColumn($column)
119111
*/
120112
protected function setTable()
121113
{
122-
123114
$this->table = DB::getDoctrineSchemaManager()->listTableDetails($this->name);
124115
}
125116
}

src/DatabaseTestHelper.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@
77
/**
88
* PHPUnit/Laravel database test helper.
99
*
10-
* @package \EGALL\EloquentPHPUnit
1110
* @author Erik Galloway <[email protected]>
1211
*/
1312
trait DatabaseTestHelper
1413
{
15-
1614
use DatabaseTransactions;
1715

1816
/**
@@ -22,13 +20,10 @@ trait DatabaseTestHelper
2220
*/
2321
public function runDatabaseMigrations()
2422
{
25-
2623
$this->artisan('migrate');
2724

2825
$this->beforeApplicationDestroyed(function () {
29-
3026
$this->artisan('migrate:reset');
31-
3227
});
3328

3429
return $this;
@@ -41,7 +36,6 @@ public function runDatabaseMigrations()
4136
*/
4237
protected function getDefaultSeeder()
4338
{
44-
4539
if (property_exists($this, 'defaultSeeder')) {
4640
return $this->defaultSeeder;
4741
}
@@ -56,7 +50,6 @@ protected function getDefaultSeeder()
5650
*/
5751
protected function getSeeders()
5852
{
59-
6053
if (property_exists($this, 'seeders')) {
6154
return $this->seeders;
6255
}
@@ -71,11 +64,9 @@ protected function getSeeders()
7164
*/
7265
protected function runDatabaseSeeders()
7366
{
74-
7567
foreach ($this->getSeeders() as $seeder) {
7668
$this->seed($seeder);
7769
}
78-
7970
}
8071

8172
/**
@@ -85,11 +76,9 @@ protected function runDatabaseSeeders()
8576
*/
8677
protected function setUp()
8778
{
88-
8979
parent::setUp();
9080

9181
$this->setUpDatabase();
92-
9382
}
9483

9584
/**
@@ -99,7 +88,6 @@ protected function setUp()
9988
*/
10089
protected function seedDatabase()
10190
{
102-
10391
if ($this->shouldSeedDatabase()) {
10492
$this->runDatabaseSeeders();
10593
}
@@ -112,9 +100,7 @@ protected function seedDatabase()
112100
*/
113101
protected function setUpDatabase()
114102
{
115-
116103
$this->runDatabaseMigrations()->seedDatabase();
117-
118104
}
119105

120106
/**
@@ -124,7 +110,6 @@ protected function setUpDatabase()
124110
*/
125111
protected function shouldSeedDatabase()
126112
{
127-
128113
if (property_exists($this, 'seedDatabase')) {
129114
return $this->seedDatabase;
130115
}

src/EloquentTestCase.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88
/**
99
* Eloquent PhpUnit test case.
1010
*
11-
* @package \EGALL\EloquentPHPUnit
1211
* @author Erik Galloway <[email protected]>
1312
*/
1413
class EloquentTestCase extends LaravelTestCase
1514
{
16-
1715
use DatabaseTestHelper, ModelTestHelper, RelationshipTestHelper;
1816

1917
/**
@@ -50,7 +48,6 @@ class EloquentTestCase extends LaravelTestCase
5048
*/
5149
public function createApplication()
5250
{
53-
5451
$app = require $this->getBootstrapFilePath();
5552

5653
$app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap();
@@ -66,7 +63,6 @@ public function createApplication()
6663
*/
6764
public function resetTable($tableName)
6865
{
69-
7066
$this->tableName = $tableName;
7167

7268
$this->data['table'] = null;
@@ -82,11 +78,9 @@ public function resetTable($tableName)
8278
*/
8379
public function setUpEloquentModel()
8480
{
85-
8681
$this->subject = new $this->model();
8782

8883
$this->setTable();
89-
9084
}
9185

9286
/**
@@ -96,7 +90,6 @@ public function setUpEloquentModel()
9690
*/
9791
public function table()
9892
{
99-
10093
if (is_null($this->data['table'])) {
10194
$this->data['table'] = (new Table($this, $this->tableName))->exists();
10295
}
@@ -112,7 +105,6 @@ public function table()
112105
*/
113106
public function __get($key)
114107
{
115-
116108
if (array_key_exists($key, $this->data)) {
117109
return $this->getKey($key);
118110
} elseif (property_exists($this, $key)) {
@@ -127,8 +119,7 @@ public function __get($key)
127119
*/
128120
protected function getBootstrapFilePath()
129121
{
130-
131-
return __DIR__ . '/../../../../bootstrap/app.php';
122+
return __DIR__.'/../../../../bootstrap/app.php';
132123
}
133124

134125
/**
@@ -139,7 +130,6 @@ protected function getBootstrapFilePath()
139130
*/
140131
protected function getKey($key)
141132
{
142-
143133
if (method_exists($this, $key)) {
144134
return $this->$key();
145135
}
@@ -154,7 +144,6 @@ protected function getKey($key)
154144
*/
155145
protected function setTable()
156146
{
157-
158147
if (!property_exists($this, 'tableName')) {
159148
$this->tableName = $this->subject->getTable();
160149
}

src/ModelTestHelper.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010
trait ModelTestHelper
1111
{
12-
1312
/**
1413
* Assert that fields exist with in an array.
1514
*
@@ -20,7 +19,6 @@ trait ModelTestHelper
2019
*/
2120
public function hasAttributes(array $expected, array $actual, $array)
2221
{
23-
2422
foreach ($expected as $field) {
2523
$this->assertTrue(
2624
in_array($field, $actual), "The {$field} attribute was not found in the {$array} array"
@@ -39,7 +37,6 @@ public function hasAttributes(array $expected, array $actual, $array)
3937
*/
4038
public function hasCasts()
4139
{
42-
4340
if (count($args = func_get_args()) == 2) {
4441
$casts = [$args[0] => $args[1]];
4542
} elseif (is_array($args[0])) {
@@ -63,7 +60,6 @@ public function hasCasts()
6360
*/
6461
public function hasDates($dates = [], $timestamps = true)
6562
{
66-
6763
if (func_num_args() > 2) {
6864
$dates = func_get_args();
6965
$timestamps = true;
@@ -85,7 +81,6 @@ public function hasDates($dates = [], $timestamps = true)
8581
*/
8682
public function hasFillable()
8783
{
88-
8984
$fields = func_get_args();
9085

9186
if (count($fields) == 1) {
@@ -102,7 +97,6 @@ public function hasFillable()
10297
*/
10398
public function hasHidden()
10499
{
105-
106100
$fields = func_get_args();
107101
if (count($fields) == 1) {
108102
$fields = is_array($fields[0]) ? $fields[0] : (array) $fields[0];
@@ -118,9 +112,7 @@ public function hasHidden()
118112
*/
119113
protected function casts()
120114
{
121-
122115
return $this->dataKey('casts');
123-
124116
}
125117

126118
/**
@@ -130,9 +122,7 @@ protected function casts()
130122
*/
131123
protected function dates()
132124
{
133-
134125
return $this->dataKey('dates');
135-
136126
}
137127

138128
/**
@@ -143,17 +133,13 @@ protected function dates()
143133
*/
144134
protected function dataKey($key)
145135
{
146-
147136
if ($this->keyNeedsSet($key)) {
148-
149-
$method = 'get' . ucfirst($key);
137+
$method = 'get'.ucfirst($key);
150138

151139
$this->data[$key] = $this->subject->$method();
152-
153140
}
154141

155142
return $this->data[$key];
156-
157143
}
158144

159145
/**
@@ -163,9 +149,7 @@ protected function dataKey($key)
163149
*/
164150
protected function fillable()
165151
{
166-
167152
return $this->dataKey('fillable');
168-
169153
}
170154

171155
/**
@@ -175,9 +159,7 @@ protected function fillable()
175159
*/
176160
protected function hidden()
177161
{
178-
179162
return $this->dataKey('hidden');
180-
181163
}
182164

183165
/**
@@ -188,8 +170,6 @@ protected function hidden()
188170
*/
189171
protected function keyNeedsSet($key)
190172
{
191-
192173
return is_null($this->data[$key]);
193-
194174
}
195175
}

0 commit comments

Comments
 (0)