Skip to content

Commit

Permalink
Merge branch '9.x' into 10.x
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Apr 13, 2024
2 parents 3d71a2d + 1ede9aa commit 7de63b7
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 11 deletions.
32 changes: 32 additions & 0 deletions CHANGELOG-8.x.md
Expand Up @@ -2,6 +2,38 @@

This changelog references the relevant changes (bug and security fixes) done to `orchestra/testbench-core`.

## 8.23.8

Released: 2024-04-13

### Changes

* Allows `Orchestra\Testbench\remote` to accept `$env` with either `array` or `string`.
* Includes `TESTBENCH_PACKAGE_REMOTE=true` when running command using `Orchestra\Testbench\remote`.

### Fixes

* Fixes `runningInUnitTests()` returning `true` when not running tests via Testbench CLI.

## 8.23.7

Released: 2024-04-08

### Changes

* Flush Statics Improvements
* Revert setting `workbench` environment variable when Testbench CLI is used outside of testing.

### Changes

## 8.23.6

Released: 2024-04-05

### Fixes

* Fixes `runningInUnitTests()` returning `true` when not running tests via Testbench CLI.

## 8.23.5

Released: 2024-03-25
Expand Down
46 changes: 46 additions & 0 deletions CHANGELOG-9.x.md
Expand Up @@ -2,6 +2,52 @@

This changelog references the relevant changes (bug and security fixes) done to `orchestra/testbench-core`.

## 9.0.12

Released: 2024-04-13

### Changes

* Allows `Orchestra\Testbench\remote` to accept `$env` with either `array` or `string`.
* Includes `TESTBENCH_PACKAGE_REMOTE=true` when running command using `Orchestra\Testbench\remote`.

### Fixes

* Fixes `runningInUnitTests()` returning `true` when not running tests via Testbench CLI.

## 9.0.11

Released: 2024-04-08

### Changes

* Flush Statics Improvements
* Revert setting `workbench` environment variable when Testbench CLI is used outside of testing.

## 9.0.10

Released: 2024-04-05

### Fixes

* Fixes `runningInUnitTests()` returning `true` when not running tests via Testbench CLI.

## 9.0.9

Released: 2024-03-27

### Fixes

* Force reset `RefreshDatabaseState` when using `LazilyRefreshDatabase` with SQLite `:in-memory:` database connections.

## 9.0.8

Released: 2024-03-26

### Changes

* Add support for `HASH_VERIFY` environment variables.

## 9.0.7

Released: 2024-03-25
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -18,8 +18,8 @@ Testbench Component is a simple package that has been designed to help you write
8.x | 6.x
9.x | 7.x
10.x | 8.x
11.x | 9.x-dev
11.x | 9.x

## Usage

**Testbench Core** is being built to enable [Laravel Framework](https://github.com/laravel/framework) to build and run integration tests for the framework itself. For package developers please use any of the following testbench projects:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -64,7 +64,7 @@
"mockery/mockery": "Allow using Mockery for testing (^1.6).",
"nunomaduro/collision": "Allow using Laravel style tests output and parallel testing (^8.0).",
"orchestra/testbench-dusk": "Allow using Laravel Dusk for testing (^9.0).",
"phpunit/phpunit": "Allow using PHPUnit for testing (^10.5).",
"phpunit/phpunit": "Allow using PHPUnit for testing (^10.5 || ^11.0).",
"symfony/process": "Required to use Orchestra\\Testbench\\remote function (^7.0).",
"symfony/yaml": "Required for Testbench CLI (^7.0).",
"vlucas/phpdotenv": "Required for Testbench CLI (^5.4.1)."
Expand Down
4 changes: 2 additions & 2 deletions laravel/config/hashing.php
Expand Up @@ -30,7 +30,7 @@

'bcrypt' => [
'rounds' => env('BCRYPT_ROUNDS', 10),
'verify' => true,
'verify' => env('HASH_VERIFY', true),
],

/*
Expand All @@ -48,7 +48,7 @@
'memory' => env('ARGON_MEMORY', 65536),
'threads' => env('ARGON_THREADS', 1),
'time' => env('ARGON_TIME', 4),
'verify' => true,
'verify' => env('HASH_VERIFY', true),
],

/*
Expand Down
2 changes: 1 addition & 1 deletion laravel/resources/views/welcome.blade.php
Expand Up @@ -140,7 +140,7 @@ class="flex items-start gap-4 rounded-lg bg-white p-6 shadow-[0px_14px_34px_0px_
<svg class="size-6 shrink-0 self-center stroke-[#FF2D20]" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12h15m0 0l-6.75-6.75M19.5 12l-6.75 6.75"/></svg>
</a>

<div class="flex items-start gap-4 rounded-lg bg-white p-6 shadow-[0px_14px_34px_0px_rgba(0,0,0,0.08)] ring-1 ring-white/[0.05] lg:pb-10 dark:bg-zinc-900 dark:ring-zinc-800">
<div class="flex items-start gap-4 rounded-lg bg-white p-6 shadow-[0px_14px_34px_0px_rgba(0,0,0,0.08)] ring-1 ring-white/[0.05] transition duration-300 hover:text-black/70 hover:ring-black/20 focus:outline-none focus-visible:ring-[#FF2D20] lg:pb-10 dark:bg-zinc-900 dark:ring-zinc-800 dark:hover:text-white/70 dark:hover:ring-zinc-700 dark:focus-visible:ring-[#FF2D20]">
<div class="flex size-12 shrink-0 items-center justify-center rounded-full bg-[#FF2D20]/10 sm:size-16">
<svg class="size-5 sm:size-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<g fill="#FF2D20">
Expand Down
5 changes: 4 additions & 1 deletion src/Concerns/InteractsWithMigrations.php
Expand Up @@ -45,7 +45,10 @@ protected function setUpInteractsWithMigrations(): void
*/
protected function tearDownInteractsWithMigrations(): void
{
if (\count($this->cachedTestMigratorProcessors) > 0 && static::usesRefreshDatabaseTestingConcern()) {
if (
(\count($this->cachedTestMigratorProcessors) > 0 && static::usesRefreshDatabaseTestingConcern())
|| ($this->usesSqliteInMemoryDatabaseConnection() && ! empty(RefreshDatabaseState::$inMemoryConnections))
) {
ResetRefreshDatabaseState::run();
}

Expand Down
9 changes: 9 additions & 0 deletions src/Console/Commander.php
Expand Up @@ -14,6 +14,7 @@
use Orchestra\Testbench\Foundation\Bootstrap\LoadMigrationsFromArray;
use Orchestra\Testbench\Foundation\Config;
use Orchestra\Testbench\Foundation\Console\Concerns\CopyTestbenchFiles;
use Orchestra\Testbench\Foundation\Env;
use Orchestra\Testbench\Foundation\TestbenchServiceProvider;
use Orchestra\Testbench\Workbench\Workbench;
use Symfony\Component\Console\Application as ConsoleApplication;
Expand Down Expand Up @@ -100,6 +101,14 @@ public function handle(): void
$laravel = $this->laravel();
$kernel = $laravel->make(ConsoleKernel::class);

if (
Env::has('TESTBENCH_PACKAGE_TESTER') === false
&& Env::has('TESTBENCH_PACKAGE_REMOTE') === false
&& $laravel->runningUnitTests() === true
) {
$laravel->instance('env', 'workbench');
}

$this->prepareCommandSignals();

$status = $kernel->handle($input, $output);
Expand Down
2 changes: 0 additions & 2 deletions src/Foundation/Application.php
Expand Up @@ -4,7 +4,6 @@

use Illuminate\Console\Application as Artisan;
use Illuminate\Console\Scheduling\ScheduleListCommand;
use Illuminate\Console\Signals;
use Illuminate\Foundation\Bootstrap\HandleExceptions;
use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables;
use Illuminate\Foundation\Bootstrap\RegisterProviders;
Expand Down Expand Up @@ -192,7 +191,6 @@ public static function flushState(): void
RegisterProviders::flushState();
RouteListCommand::resolveTerminalWidthUsing(null);
ScheduleListCommand::resolveTerminalWidthUsing(null);
Signals::resolveAvailabilityUsing(null);
Sleep::fake(false);
ThrottleRequests::shouldHashKeys();
TrimStrings::flushState();
Expand Down
2 changes: 2 additions & 0 deletions src/Foundation/Console/ServeCommand.php
Expand Up @@ -6,9 +6,11 @@
use Illuminate\Foundation\Console\ServeCommand as Command;
use Orchestra\Testbench\Foundation\Events\ServeCommandEnded;
use Orchestra\Testbench\Foundation\Events\ServeCommandStarted;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'serve', description: 'Serve the application on the PHP development server')]
class ServeCommand extends Command
{
/**
Expand Down
10 changes: 8 additions & 2 deletions src/functions.php
Expand Up @@ -73,10 +73,10 @@ function artisan(Contracts\TestCase|ApplicationContract $context, string $comman
* @api
*
* @param array<int, string>|string $command
* @param array<string, mixed> $env
* @param array<string, mixed>|string $env
* @return \Symfony\Component\Process\Process
*/
function remote(array|string $command, array $env = []): Process
function remote(array|string $command, array|string $env = []): Process
{
$phpBinary = transform(
\defined('PHP_BINARY') ? PHP_BINARY : (new PhpExecutableFinder())->find(),
Expand All @@ -89,6 +89,12 @@ function remote(array|string $command, array $env = []): Process
? ProcessUtils::escapeArgument((string) $vendorBin)
: $binary;

if (\is_string($env)) {
$env = ['APP_ENV' => $env];
}

Arr::add($env, 'TESTBENCH_PACKAGE_REMOTE', '(true)');

return Process::fromShellCommandline(
command: Arr::join([$phpBinary, $commander, ...Arr::wrap($command)], ' '),
cwd: package_path(),
Expand Down

0 comments on commit 7de63b7

Please sign in to comment.