Skip to content

Commit f98f7ec

Browse files
committed
Use newly refactored method
1 parent 71a4f57 commit f98f7ec

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/Generators/TestGenerator.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ protected function buildTestCases(Controller $controller)
121121
: config('blueprint.namespace');
122122

123123
if (in_array($name, ['edit', 'update', 'show', 'destroy'])) {
124-
if ($this->isLaravel8OrHigher()) {
124+
if (Blueprint::isLaravel8OrHigher()) {
125125
$setup['data'][] = sprintf('$%s = %s::factory()->create();', $variable, $model);
126126
} else {
127127
$setup['data'][] = sprintf('$%s = factory(%s::class)->create();', $variable, $model);
@@ -434,14 +434,14 @@ protected function buildTestCases(Controller $controller)
434434
$assertions['generic'][] = '$this->assertDatabaseHas('.Str::camel(Str::plural($model)).', [ /* ... */ ]);';
435435
}
436436
} elseif ($statement->operation() === 'find') {
437-
if ($this->isLaravel8OrHigher()) {
437+
if (Blueprint::isLaravel8OrHigher()) {
438438
$setup['data'][] = sprintf('$%s = %s::factory()->create();', $variable, $model);
439439
} else {
440440
$setup['data'][] = sprintf('$%s = factory(%s::class)->create();', $variable, $model);
441441
}
442442
} elseif ($statement->operation() === 'delete') {
443443
$tested_bits |= self::TESTS_DELETE;
444-
if ($this->isLaravel8OrHigher()) {
444+
if (Blueprint::isLaravel8OrHigher()) {
445445
$setup['data'][] = sprintf('$%s = %s::factory()->create();', $variable, $model);
446446
} else {
447447
$setup['data'][] = sprintf('$%s = factory(%s::class)->create();', $variable, $model);
@@ -458,7 +458,7 @@ protected function buildTestCases(Controller $controller)
458458
}
459459
} elseif ($statement instanceof QueryStatement) {
460460
$this->addRefreshDatabaseTrait($controller);
461-
if ($this->isLaravel8OrHigher()) {
461+
if (Blueprint::isLaravel8OrHigher()) {
462462
$setup['data'][] = sprintf('$%s = %s::factory()->times(3)->create();', Str::plural($variable), $model);
463463
} else {
464464
$setup['data'][] = sprintf('$%s = factory(%s::class, 3)->create();', Str::plural($variable), $model);
@@ -690,7 +690,7 @@ private function generateReferenceFactory(Column $local_column, Controller $cont
690690
$reference = $local_column->attributes()[0];
691691
}
692692

693-
if ($this->isLaravel8OrHigher()) {
693+
if (Blueprint::isLaravel8OrHigher()) {
694694
$faker = sprintf('$%s = %s::factory()->create();', Str::beforeLast($local_column->name(), '_id'), Str::studly($reference));
695695
} else {
696696
$faker = sprintf('$%s = factory(%s::class)->create();', Str::beforeLast($local_column->name(), '_id'), Str::studly($reference));
@@ -700,9 +700,4 @@ private function generateReferenceFactory(Column $local_column, Controller $cont
700700

701701
return [$faker, $variable_name];
702702
}
703-
704-
protected function isLaravel8OrHigher()
705-
{
706-
return version_compare(App::version(), '8.0.0', '>=');
707-
}
708703
}

0 commit comments

Comments
 (0)