Skip to content

Commit 724ef35

Browse files
committed
2025-11-17までの原文変更点反映。
1 parent 1ed5460 commit 724ef35

File tree

8 files changed

+184
-12
lines changed

8 files changed

+184
-12
lines changed

original-en/broadcasting.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,15 @@ class ServerCreated implements ShouldBroadcast, ShouldDispatchAfterCommit
777777
778778
Private channels require you to authorize that the currently authenticated user can actually listen on the channel. This is accomplished by making an HTTP request to your Laravel application with the channel name and allowing your application to determine if the user can listen on that channel. When using [Laravel Echo](#client-side-installation), the HTTP request to authorize subscriptions to private channels will be made automatically.
779779
780-
When broadcasting is enabled, Laravel automatically registers the `/broadcasting/auth` route to handle authorization requests. The `/broadcasting/auth` route is automatically placed within the `web` middleware group.
780+
When broadcasting is installed Laravel attempts to automatically register the `/broadcasting/auth` route to handle authorization requests. If Laravel fails to automatically register these routes, you may register them manually in your application's `/bootstrap/app.php` file:
781+
782+
```php
783+
->withRouting(
784+
web: __DIR__.'/../routes/web.php',
785+
channels: __DIR__.'/../routes/channels.php',
786+
health: '/up',
787+
)
788+
```
781789
782790
<a name="defining-authorization-callbacks"></a>
783791
### Defining Authorization Callbacks

original-en/http-client.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -397,17 +397,17 @@ return Http::post(/* ... */)->throw(function (Response $response, RequestExcepti
397397
})->json();
398398
```
399399

400-
By default, `RequestException` messages are truncated to 120 characters when logged or reported. To customize or disable this behavior, you may utilize the `truncateRequestExceptionsAt` and `dontTruncateRequestExceptions` methods when configuring your application's exception handling behavior in your `bootstrap/app.php` file:
400+
By default, `RequestException` messages are truncated to 120 characters when logged or reported. To customize or disable this behavior, you may utilize the `truncateAt` and `dontTruncate` methods when configuring your application's registered behavior in your `bootstrap/app.php` file:
401401

402402
```php
403-
use Illuminate\Foundation\Configuration\Exceptions;
403+
use Illuminate\Http\Client\RequestException;
404404

405-
->withExceptions(function (Exceptions $exceptions): void {
405+
->registered(function (): void {
406406
// Truncate request exception messages to 240 characters...
407-
$exceptions->truncateRequestExceptionsAt(240);
407+
RequestException::truncateAt(240);
408408

409409
// Disable request exception message truncation...
410-
$exceptions->dontTruncateRequestExceptions();
410+
RequestException::dontTruncate();
411411
})
412412
```
413413

original-en/http-tests.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- [Testing File Uploads](#testing-file-uploads)
1313
- [Testing Views](#testing-views)
1414
- [Rendering Blade and Components](#rendering-blade-and-components)
15+
- [Caching Routes](#caching-routes)
1516
- [Available Assertions](#available-assertions)
1617
- [Response Assertions](#response-assertions)
1718
- [Authentication Assertions](#authentication-assertions)
@@ -938,6 +939,51 @@ $view = $this->component(Profile::class, ['name' => 'Taylor']);
938939
$view->assertSee('Taylor');
939940
```
940941

942+
<a name="caching-routes"></a>
943+
## Caching Routes
944+
945+
Before a test runs, Laravel boots a fresh instance of the application, including collecting all defined routes. If your applications have many route files, you may wish to add the `Illuminate\Foundation\Testing\WithCachedRoutes` trait to your test cases. On tests which use this trait, routes are built once and stored in memory, meaning the route collection process is only run once for all tests in your suite:
946+
947+
```php tab=Pest
948+
<?php
949+
950+
use App\Http\Controllers\UserController;
951+
use Illuminate\Foundation\Testing\WithCachedRoutes;
952+
953+
pest()->use(WithCachedRoutes::class);
954+
955+
test('basic example', function () {
956+
$this->get(action([UserController::class, 'index']));
957+
958+
// ...
959+
});
960+
```
961+
962+
```php tab=PHPUnit
963+
<?php
964+
965+
namespace Tests\Feature;
966+
967+
use App\Http\Controllers\UserController;
968+
use Illuminate\Foundation\Testing\WithCachedRoutes;
969+
use Tests\TestCase;
970+
971+
class BasicTest extends TestCase
972+
{
973+
use WithCachedRoutes;
974+
975+
/**
976+
* A basic functional test example.
977+
*/
978+
public function test_basic_example(): void
979+
{
980+
$response = $this->get(action([UserController::class, 'index']));
981+
982+
// ...
983+
}
984+
}
985+
```
986+
941987
<a name="available-assertions"></a>
942988
## Available Assertions
943989

original-en/testing.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- [Running Tests in Parallel](#running-tests-in-parallel)
88
- [Reporting Test Coverage](#reporting-test-coverage)
99
- [Profiling Tests](#profiling-tests)
10+
- [Caching Configuration](#caching-configuration)
1011

1112
<a name="introduction"></a>
1213
## Introduction
@@ -221,3 +222,34 @@ The Artisan test runner also includes a convenient mechanism for listing your ap
221222
```shell
222223
php artisan test --profile
223224
```
225+
226+
<a name="configuration-caching"></a>
227+
## Configuration Caching
228+
229+
When running tests, Laravel boots the application for each individual test method. Without a cached configuration file, each configuration file in your application must be loaded at the start of a test. To build the configuration once and re-use it for all tests in a single run, you may use the `Illuminate\Foundation\Testing\WithCachedConfig` trait:
230+
231+
```php tab=Pest
232+
<?php
233+
234+
use Illuminate\Foundation\Testing\WithCachedConfig;
235+
236+
pest()->use(WithCachedConfig::class);
237+
238+
// ...
239+
```
240+
241+
```php tab=PHPUnit
242+
<?php
243+
244+
namespace Tests\Feature;
245+
246+
use Illuminate\Foundation\Testing\WithCachedConfig;
247+
use Tests\TestCase;
248+
249+
class ConfigTest extends TestCase
250+
{
251+
use WithCachedConfig;
252+
253+
// ...
254+
}
255+
```

translation-ja/broadcasting.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,15 @@ class ServerCreated implements ShouldBroadcast, ShouldDispatchAfterCommit
777777
778778
プライベートチャンネルでは、現在認証済みのユーザーが、実際にチャンネルをリッスンできることを認証する必要があります。これは、チャンネル名を指定してLaravelアプリケーションにHTTPリクエストを行い、ユーザーがそのチャンネルをリッスンできるかどうかをアプリケーション側が判断することで実現します。[Laravel Echo](#client-side-installation)を使用すると、プライベートチャンネルのサブスクリプションを承認するHTTPリクエストが自動的に行われます。
779779
780-
ブロードキャストを有効になると、Laravelは認証リクエストを処理するため、`/broadcasting/auth`ルートを自動的に登録します。`/broadcasting/auth`ルートは自動的に、`web`ミドルウェアグループへ配置します
780+
ブロードキャストをインストールすると、Laravelは認証リクエストを処理するために`/broadcasting/auth`ルートを自動的に登録しようと試みます。Laravelがこれらのルートを自動登録できない場合、アプリケーションの`/bootstrap/app.php`ファイルへ手作業で登録してください。
781+
782+
```php
783+
->withRouting(
784+
web: __DIR__.'/../routes/web.php',
785+
channels: __DIR__.'/../routes/channels.php',
786+
health: '/up',
787+
)
788+
```
781789
782790
<a name="defining-authorization-callbacks"></a>
783791
### 認可コールバックの定義

translation-ja/http-client.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -397,17 +397,17 @@ return Http::post(/* ... */)->throw(function (Response $response, RequestExcepti
397397
})->json();
398398
```
399399

400-
`RequestException`のメッセージはログに記録したり、報告したりするとき、デフォルトで120文字に切り詰めます。この動作をカスタマイズ、もしくは無効にするには、`bootstrap/app.php`ファイルでアプリケーションの例外処理動作を設定するときに、`truncateRequestExceptionsAt`メソッドと`dontTruncateRequestExceptions`メソッドを利用してください。
400+
`RequestException`メッセージは、ログ記録または報告時にデフォルトで120文字に切り詰められます。この動作をカスタマイズまたは無効化するには、`bootstrap/app.php`ファイルでアプリケーションの登録済み動作を設定する際に、`truncateAt`および`dontTruncate`メソッドを利用してください。
401401

402402
```php
403-
use Illuminate\Foundation\Configuration\Exceptions;
403+
use Illuminate\Http\Client\RequestException;
404404

405-
->withExceptions(function (Exceptions $exceptions): void {
405+
->registered(function (): void {
406406
// リクエストの例外メッセージを240文字に切り詰める
407-
$exceptions->truncateRequestExceptionsAt(240);
407+
RequestException::truncateAt(240);
408408

409409
// リクエストの例外メッセージの切り詰めを無効にする
410-
$exceptions->dontTruncateRequestExceptions();
410+
RequestException::dontTruncate();
411411
})
412412
```
413413

translation-ja/http-tests.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- [ファイルアップロードのテスト](#testing-file-uploads)
1313
- [ビューのテスト](#testing-views)
1414
- [Bladeとコンポーネントのレンダ](#rendering-blade-and-components)
15+
- [ルートのキャッシュ](#caching-routes)
1516
- [利用可能なアサート](#available-assertions)
1617
- [レスポンスのアサート](#response-assertions)
1718
- [認証のアサート](#authentication-assertions)
@@ -938,6 +939,51 @@ $view = $this->component(Profile::class, ['name' => 'Taylor']);
938939
$view->assertSee('Taylor');
939940
```
940941

942+
<a name="caching-routes"></a>
943+
## ルートのキャッシュ
944+
945+
テストを実行する前に、Laravelはアプリケーションの新しいインスタンスを起動し、定義済みのルートをすべて収集します。アプリケーションに多くのルートファイルがある場合、テストケースに`Illuminate\Foundation\Testing\WithCachedRoutes`トレイトを追加することをお勧めします。このトレイトを使用するテストでは、ルートは一度構築後メモリに保存するため、ルート収集プロセスをテストスイート内のすべてのテストに対して一度だけ実行します。
946+
947+
```php tab=Pest
948+
<?php
949+
950+
use App\Http\Controllers\UserController;
951+
use Illuminate\Foundation\Testing\WithCachedRoutes;
952+
953+
pest()->use(WithCachedRoutes::class);
954+
955+
test('basic example', function () {
956+
$this->get(action([UserController::class, 'index']));
957+
958+
// …
959+
});
960+
```
961+
962+
```php tab=PHPUnit
963+
<?php
964+
965+
namespace Tests\Feature;
966+
967+
use App\Http\Controllers\UserController;
968+
use Illuminate\Foundation\Testing\WithCachedRoutes;
969+
use Tests\TestCase;
970+
971+
class BasicTest extends TestCase
972+
{
973+
use WithCachedRoutes;
974+
975+
/**
976+
* 基本的な機能テストの例
977+
*/
978+
public function test_basic_example(): void
979+
{
980+
$response = $this->get(action([UserController::class, 'index']));
981+
982+
// …
983+
}
984+
}
985+
```
986+
941987
<a name="available-assertions"></a>
942988
## 利用可能なアサート
943989

translation-ja/testing.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- [テストを並列で実行](#running-tests-in-parallel)
88
- [テストカバレージのレポート](#reporting-test-coverage)
99
- [テストのプロファイル](#profiling-tests)
10+
- [設定のキャッシュ](#caching-configuration)
1011

1112
<a name="introduction"></a>
1213
## イントロダクション
@@ -221,3 +222,34 @@ Artisanテストランナは、アプリケーションの最も遅いテスト
221222
```shell
222223
php artisan test --profile
223224
```
225+
226+
<a name="configuration-caching"></a>
227+
## 設定のキャッシュ
228+
229+
テストを実行する際、Laravelは個々のテストメソッドごとにアプリケーションを起動します。キャッシュした設定ファイルがない場合、アプリケーション内の各設定ファイルをテスト開始時に読み込む必要が起こります。設定を一度構築し、単一の実行内の全テストで再利用するには、`Illuminate\Foundation\Testing\WithCachedConfig`トレイトを使用してください。
230+
231+
```php tab=Pest
232+
<?php
233+
234+
use Illuminate\Foundation\Testing\WithCachedConfig;
235+
236+
pest()->use(WithCachedConfig::class);
237+
238+
// ...
239+
```
240+
241+
```php tab=PHPUnit
242+
<?php
243+
244+
namespace Tests\Feature;
245+
246+
use Illuminate\Foundation\Testing\WithCachedConfig;
247+
use Tests\TestCase;
248+
249+
class ConfigTest extends TestCase
250+
{
251+
use WithCachedConfig;
252+
253+
// ...
254+
}
255+
```

0 commit comments

Comments
 (0)