@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | public function getModel(): ?string |
25 | 25 | { |
26 | - throw_if(is_null($this->tested) || ! $this->isModelClass($this->tested), |
|
26 | + throw_if(is_null($this->tested) || !$this->isModelClass($this->tested), |
|
27 | 27 | new \Exception('You have to use a Eloquent Model')); |
28 | 28 | |
29 | 29 | return $this->tested; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | public function getTable(): string |
33 | 33 | { |
34 | - throw_if(! $this->isExistingTable($this->table), |
|
34 | + throw_if(!$this->isExistingTable($this->table), |
|
35 | 35 | new \Exception('You have to use an existing table')); |
36 | 36 | |
37 | 37 | return $this->getModelTable(); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | public function getModelTable(): string |
41 | 41 | { |
42 | - if (! empty($this->table)) { |
|
42 | + if (!empty($this->table)) { |
|
43 | 43 | return $this->table; |
44 | 44 | } |
45 | 45 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | public function isModelClass(?string $modelClass = null): bool |
52 | 52 | { |
53 | - if (! is_null($modelClass)) { |
|
53 | + if (!is_null($modelClass)) { |
|
54 | 54 | return (new $modelClass) instanceof Model; |
55 | 55 | } else { |
56 | 56 | return (new $this->tested) instanceof Model; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | public function isExistingTable(?string $tableName = null): bool |
61 | 61 | { |
62 | - if (! is_null($tableName)) { |
|
62 | + if (!is_null($tableName)) { |
|
63 | 63 | return Schema::hasTable($tableName); |
64 | 64 | } else { |
65 | 65 | return Schema::hasTable($this->getModelTable()); |
@@ -68,17 +68,17 @@ discard block |
||
68 | 68 | |
69 | 69 | public function assertHasColumns(array $columns): self |
70 | 70 | { |
71 | - collect($columns)->each(function ($column) { |
|
71 | + collect($columns)->each(function($column) { |
|
72 | 72 | $this->assertTrue(in_array($column, Schema::getColumnListing($this->getTable()))); |
73 | 73 | }); |
74 | 74 | |
75 | 75 | return $this; |
76 | 76 | } |
77 | 77 | |
78 | - public function assertCanFillables(array $columns = []): self |
|
78 | + public function assertCanFillables(array $columns = [ ]): self |
|
79 | 79 | { |
80 | 80 | $modelClass = $this->getModel(); |
81 | - $this->assertEquals([], collect($columns)->diff((new $modelClass)->getFillable())->toArray()); |
|
81 | + $this->assertEquals([ ], collect($columns)->diff((new $modelClass)->getFillable())->toArray()); |
|
82 | 82 | |
83 | 83 | return $this; |
84 | 84 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $relatedInstance = factory($related)->create(); |
107 | 107 | $foreignKey = $foreignKey ?: $relatedInstance->getForeignKey(); |
108 | 108 | |
109 | - $modelInstance = factory($this->getModel())->create([$foreignKey => $relatedInstance->id]); |
|
109 | + $modelInstance = factory($this->getModel())->create([ $foreignKey => $relatedInstance->id ]); |
|
110 | 110 | $relatedInstance2 = factory($related)->create(); |
111 | 111 | $modelInstance2 = factory($this->getModel())->make(); |
112 | 112 | $modelInstance2->{$relation}()->associate($relatedInstance2)->save(); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | public function assertHasBelongsToMorphRelation(string $related, string $name, ?string $type = null, ?string $id = null): self |
150 | 150 | { |
151 | - [$type, $id] = $this->getMorphs($name, $type, $id); |
|
151 | + [ $type, $id ] = $this->getMorphs($name, $type, $id); |
|
152 | 152 | |
153 | 153 | $instance = factory($related)->create(); |
154 | 154 | $morph = factory($this->getModel())->create([ |
@@ -179,6 +179,6 @@ discard block |
||
179 | 179 | |
180 | 180 | private function getMorphs(string $name, ?string $type, ?string $id): array |
181 | 181 | { |
182 | - return [$type ?: $name.'_type', $id ?: $name.'_id']; |
|
182 | + return [ $type ?: $name.'_type', $id ?: $name.'_id' ]; |
|
183 | 183 | } |
184 | 184 | } |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use Faker\Generator as Faker; |
6 | 6 | use Thomasdominic\ModelsTestor\Tests\TestModels\FirstModel; |
7 | 7 | |
8 | -$factory->define(FirstModel::class, function (Faker $faker) { |
|
8 | +$factory->define(FirstModel::class, function(Faker $faker) { |
|
9 | 9 | return [ |
10 | 10 | 'name' => $faker->word(), |
11 | 11 | ]; |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use Faker\Generator as Faker; |
6 | 6 | use Thomasdominic\ModelsTestor\Tests\TestModels\SecondModel; |
7 | 7 | |
8 | -$factory->define(SecondModel::class, function (Faker $faker) { |
|
8 | +$factory->define(SecondModel::class, function(Faker $faker) { |
|
9 | 9 | return [ |
10 | 10 | 'name' => $faker->word(), |
11 | 11 | 'first_model_id' => null, |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use Faker\Generator as Faker; |
6 | 6 | use Thomasdominic\ModelsTestor\Tests\TestModels\ThirdModel; |
7 | 7 | |
8 | -$factory->define(ThirdModel::class, function (Faker $faker) { |
|
8 | +$factory->define(ThirdModel::class, function(Faker $faker) { |
|
9 | 9 | return [ |
10 | 10 | 'name' => $faker->word(), |
11 | 11 | ]; |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use Faker\Generator as Faker; |
6 | 6 | use Thomasdominic\ModelsTestor\Tests\TestModels\MorphModel; |
7 | 7 | |
8 | -$factory->define(MorphModel::class, function (Faker $faker) { |
|
8 | +$factory->define(MorphModel::class, function(Faker $faker) { |
|
9 | 9 | return [ |
10 | 10 | 'name' => $faker->word(), |
11 | 11 | 'morph_modelable_type' => null, |