Skip to content

Commit

Permalink
Merge branch '8.x' into 9.x
Browse files Browse the repository at this point in the history
  • Loading branch information
crynobone committed Dec 11, 2024
2 parents 83ca604 + 6f12867 commit 5548ee3
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Concerns/Database/InteractsWithSqliteDatabaseFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected function withoutSqliteDatabase(callable $callback): void
if ($filesystem->exists($database)) {
$filesystem->move($database, $temporary = "{$database}.backup-{$time}");

array_push($this->files, $temporary);
$this->files[] = $temporary;
}

value($callback);
Expand Down
8 changes: 4 additions & 4 deletions src/Concerns/InteractsWithTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ trait InteractsWithTestCase
/**
* The method attributes for test case.
*
* @var array<string, array<int, array{key: class-string, instance: object}>>
* @var array<int, array{key: class-string, instance: object}>
*
* @phpstan-var array<string, array<int, array{key: class-string<TTestingFeature>, instance: TTestingFeature}>>
* @phpstan-var array<int, array{key: class-string<TTestingFeature>, instance: TTestingFeature}>
*/
protected static array $testCaseTestingFeatures = [];

Expand Down Expand Up @@ -110,10 +110,10 @@ public static function usesTestingFeature($attribute): void
/** @var class-string<TTestingFeature> $name */
$name = \get_class($attribute);

array_push(static::$testCaseTestingFeatures, [
static::$testCaseTestingFeatures[] = [
'key' => $name,
'instance' => $attribute,
]);
];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Concerns/InteractsWithWorkbench.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected function getPackageProvidersUsingWorkbench($app): ?array
$providers = $config?->getExtraAttributes()['providers'] ?? [];

if ($hasAuthentication && class_exists('Orchestra\Workbench\AuthServiceProvider')) {
array_push($providers, 'Orchestra\Workbench\AuthServiceProvider');
$providers[] = 'Orchestra\Workbench\AuthServiceProvider';
}

if (empty($providers)) {
Expand Down
15 changes: 14 additions & 1 deletion src/Foundation/Console/Actions/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,24 @@ abstract class Action
*/
protected function pathLocation(string $path): string
{
$packagePath = package_path();

if (! \is_null($this->workingPath)) {
$path = str_replace(rtrim($this->workingPath, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR, '', $path);

$prefix = match ($this->workingPath) {
app()->basePath() => '@laravel',
$packagePath => '.',
default => '@'
};

return implode('/', [$prefix, ltrim($path, '/')]);
}

$path = str_replace(package_path(), '', $path);

if (str_starts_with($path, $packagePath)) {
return sprintf('./%s', ltrim(str_replace($packagePath, '', $path), '/'));
}

return $path;
}
Expand Down
4 changes: 2 additions & 2 deletions src/PHPUnit/AttributeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static function forClass(string $className): array
[$name, $instance] = static::resolveAttribute($attribute);

if (! \is_null($name) && ! \is_null($instance)) {
array_push($attributes, ['key' => $name, 'instance' => $instance]);
$attributes[] = ['key' => $name, 'instance' => $instance];
}
}

Expand Down Expand Up @@ -75,7 +75,7 @@ public static function forMethod(string $className, string $methodName): array
[$name, $instance] = static::resolveAttribute($attribute);

if (! \is_null($name) && ! \is_null($instance)) {
array_push($attributes, ['key' => $name, 'instance' => $instance]);
$attributes[] = ['key' => $name, 'instance' => $instance];
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Foundation/Console/CreateSqliteDbCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function it_can_generate_database_using_command()
$this->assertFalse(file_exists(database_path('database.sqlite')));

$this->artisan('package:create-sqlite-db')
->expectsOutputToContain('File [database/database.sqlite] generated')
->expectsOutputToContain('File [@laravel/database/database.sqlite] generated')
->assertOk();

$this->assertTrue(file_exists(database_path('database.sqlite')));
Expand All @@ -45,7 +45,7 @@ public function it_cannot_generate_database_using_command_when_database_already_
$this->assertTrue(file_exists(database_path('database.sqlite')));

$this->artisan('package:create-sqlite-db')
->expectsOutputToContain('File [database/database.sqlite] already exists')
->expectsOutputToContain('File [@laravel/database/database.sqlite] already exists')
->assertOk();
});
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Foundation/Console/DropSqliteDbCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function it_can_drop_database_using_command()
$this->assertTrue(file_exists(database_path('database.sqlite')));

$this->artisan('package:drop-sqlite-db')
->expectsOutputToContain('File [database/database.sqlite] has been deleted')
->expectsOutputToContain('File [@laravel/database/database.sqlite] has been deleted')
->assertOk();

$this->assertFalse(file_exists(database_path('database.sqlite')));
Expand All @@ -45,7 +45,7 @@ public function it_cannot_drop_database_using_command_when_database_doesnt_exist
$this->assertFalse(file_exists(database_path('database.sqlite')));

$this->artisan('package:drop-sqlite-db')
->expectsOutputToContain('File [database/database.sqlite] doesn\'t exists')
->expectsOutputToContain('File [@laravel/database/database.sqlite] doesn\'t exists')
->assertOk();
});
}
Expand Down

0 comments on commit 5548ee3

Please sign in to comment.