Skip to content

Commit

Permalink
Merge branch '7.x' into 8.x
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Jul 13, 2024
2 parents f7ac8b8 + 71fc892 commit fcac743
Show file tree
Hide file tree
Showing 9 changed files with 191 additions and 2 deletions.
28 changes: 28 additions & 0 deletions CHANGELOG-7.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,34 @@

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

## 7.43.0

Released: 2024-07-13

### Changes

* Update minimum support for Testbench Core v7.44.0+. ([v7.43.3...v7.44.0](https://github.com/orchestral/testbench-core/compare/v7.43.3...v7.44.0))

#### Testbench Changes

##### Added

* Added new attributes:
- `Orchestra\Testbench\Attributes\ResolvesLaravel`
- `Orchestra\Testbench\Attributes\UsesFrameworkConfiguration`
* Allows to discover `factories` using Workbench to map `Workbench\App\Models` to `Workbench\Database\Factories` classes.
* Allows to auto discover console command classes from `workbench/app/Console/Commands`.

##### Changes

* Implements `JsonSerializable` to `Orchestra\Testbench\Foundation\UndefinedValue`.
* Update skeleton to use `workbench` as default environment value.
* Allow `Orchestra\Testbench\Attributes\Define` and `Orchestra\Testbench\Attributes\DefineEnvironment` to be used on the class level by [@danjohnson95](https://github.com/danjohnson95)

##### Fixes

* Ensure `usesTestingFeature()` attribute registration is loaded before class attributes instead of method attributes.

## 7.42.2

Released: 2024-06-04
Expand Down
2 changes: 1 addition & 1 deletion bin/sync
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Illuminate\Support\Collection::make([
$files->copy("{$workingPath}/core/testbench.yaml", "{$workingPath}/testbench.yaml");

Illuminate\Support\Collection::make([
...$files->glob("{$workingPath}/core/workbench/app/View/Components/*"),
...$files->glob("{$workingPath}/core/workbench/app/*"),
])->flatten()
->filter(fn ($file) => is_file($file))
->each(function ($file) use ($files, $workingPath) {
Expand Down
1 change: 0 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
</exclude>
</groups>
<php>
<server name="APP_ENV" value="testing"/>
<server name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<server name="RAY_ENABLED" value="(true)"/>
</php>
Expand Down
34 changes: 34 additions & 0 deletions workbench/app/Console/Commands/DummyCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Workbench\App\Console\Commands;

use Illuminate\Console\Command;

class DummyCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'sample:command';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Sample command';

/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$this->info('It works!');

return 0;
}
}
27 changes: 27 additions & 0 deletions workbench/app/Http/Controllers/ExampleController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Workbench\App\Http\Controllers;

use Closure;
use Illuminate\Routing\Controller;
use PHPUnit\Framework\Assert;

class ExampleController extends Controller
{
public function __construct()
{
$this->middleware(function ($request, Closure $next) {
$route = app('router')->getCurrentRoute();

Assert::assertSame('index', $route->getActionMethod());
Assert::assertSame(ExampleController::class, \get_class($route->getController()));

return $next($request);
});
}

public function index()
{
return 'ExampleController@index';
}
}
15 changes: 15 additions & 0 deletions workbench/app/Jobs/CustomPayloadJob.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Workbench\App\Jobs;

use Illuminate\Contracts\Queue\ShouldQueue;

class CustomPayloadJob implements ShouldQueue
{
public $connection = 'sync';

public function handle()
{
//
}
}
11 changes: 11 additions & 0 deletions workbench/app/Jobs/RegisterUser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Workbench\App\Jobs;

class RegisterUser
{
public function handle()
{
//
}
}
42 changes: 42 additions & 0 deletions workbench/app/Models/User.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Workbench\App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
use HasFactory, Notifiable;

/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
];

/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];

/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}
33 changes: 33 additions & 0 deletions workbench/app/Providers/WorkbenchServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Workbench\App\Providers;

use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;

class WorkbenchServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
$this->loadMigrationsFrom(realpath(__DIR__.'/../../database/migrations'));
}

/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
Route::macro('text', function (string $url, string $content) {
return $this->get($url, function () use ($content) {
return response($content)->header('Content-Type', 'text/plain');
});
});
}
}

0 comments on commit fcac743

Please sign in to comment.