Skip to content

Commit

Permalink
Merge branch '6.x' into 7.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 May 20, 2024
2 parents c115dfa + 50aa345 commit 59882df
Show file tree
Hide file tree
Showing 13 changed files with 124 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/bin export-ignore
/docs export-ignore
/tests export-ignore
/workbench export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/phpstan-baseline.neon export-ignore
Expand Down
3 changes: 3 additions & 0 deletions bin/sync
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ $files->deleteDirectory("{$workingPath}/skeleton");
$files->copy("{$workingPath}/vendor/orchestra/testbench-core/laravel/bootstrap/app.php", "{$workingPath}/laravel/bootstrap/app.php");
$files->copy("{$workingPath}/vendor/orchestra/testbench-core/laravel/server.php", "{$workingPath}/laravel/server.php");
$files->copy("{$workingPath}/vendor/orchestra/testbench-core/laravel/.gitignore", "{$workingPath}/laravel/.gitignore");
$files->copyDirectory("{$workingPath}/vendor/orchestra/testbench-core/workbench/app/View", "{$workingPath}/workbench/app/View");
$files->copyDirectory("{$workingPath}/vendor/orchestra/testbench-core/workbench/resources", "{$workingPath}/workbench/resources");
$files->copyDirectory("{$workingPath}/vendor/orchestra/testbench-core/workbench/routes", "{$workingPath}/workbench/routes");
$files->copy("{$workingPath}/vendor/laravel/dusk/stubs/phpunit.xml", "{$workingPath}/stubs/phpunit.xml");

Symfony\Component\Process\Process::fromShellCommandline(
Expand Down
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
},
"require-dev": {
"laravel/pint": "^1.4",
"laravel/tinker": "^2.9",
"phpstan/phpstan": "^1.11"
},
"extra": {
Expand Down Expand Up @@ -91,6 +92,10 @@
]
},
"config": {
"preferred-install": {
"orchestra/testbench-core": "source",
"*": "auto"
},
"sort-packages": true
},
"prefer-stable": true,
Expand Down
11 changes: 8 additions & 3 deletions testbench.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
providers:
- Workbench\App\Providers\RouteServiceProvider
- Workbench\App\Providers\WorkbenchServiceProvider

migrations:
- workbench/database/migrations

workbench:
start: '/'
welcome: true
welcome: false
build:
- drop-sqlite-db
- create-sqlite-db
- migrate:refresh
discovers:
config: true
web: true
api: true
commands: true
views: true
12 changes: 11 additions & 1 deletion tests/Browser/WorkbenchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,18 @@ public function it_can_browse_the_default_page()
public function it_can_browse_the_welcome_page()
{
$this->browse(function ($browser) {
$browser->visit('/welcome')
$browser->visit('/')
->assertSee('Laravel');
});
}

/** @test */
public function it_can_browse_routes_from_discovers_routes()
{
$this->browse(function ($browser) {
$browser->visit('/testbench')
->assertSee('Alert Component')
->assertSee('Notification Component');
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;

class RouteServiceProvider extends ServiceProvider
class WorkbenchServiceProvider extends ServiceProvider
{
/**
* Register services.
Expand All @@ -24,6 +24,10 @@ public function register()
*/
public function boot()
{
Route::view('welcome', 'welcome');
Route::macro('text', function (string $url, string $content) {
return $this->get($url, function () use ($content) {
return response($content)->header('Content-Type', 'text/plain');
});
});
}
}
17 changes: 17 additions & 0 deletions workbench/app/View/Components/Alert.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Workbench\App\View\Components;

use Illuminate\View\Component;
use Illuminate\View\View;

class Alert extends Component
{
/**
* Get the view / contents that represent the component.
*/
public function render()
{
return '<div>Alert Component</div>';
}
}
5 changes: 5 additions & 0 deletions workbench/resources/lang/en/welcome.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
'morning' => 'Good Morning',
];
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div>Notification Component</div>
9 changes: 9 additions & 0 deletions workbench/resources/views/testbench.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
</head>
<body>
<x-workbench::alert />
<x-workbench::notification />
</body>
</html>
18 changes: 18 additions & 0 deletions workbench/routes/api.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/

Route::get('/hello', function () {
return response()->json('hello world');
});
19 changes: 19 additions & 0 deletions workbench/routes/console.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;

/*
|--------------------------------------------------------------------------
| Console Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of your Closure based console
| commands. Each Closure is bound to a command instance allowing a
| simple approach to interacting with each command's IO methods.
|
*/

Artisan::command('workbench:inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');
21 changes: 21 additions & 0 deletions workbench/routes/web.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/

Route::get('/', function () {
return view('welcome');
});

Route::view('/testbench', 'workbench::testbench')->name('testbench');
Route::text('/hello-world', 'Hello world');

0 comments on commit 59882df

Please sign in to comment.