-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Translate http-tests.md (v5.5) #374
Translate http-tests.md (v5.5) #374
Conversation
http-tests.md
Outdated
|
||
Laravel provides a very fluent API for making HTTP requests to your application and examining the output. For example, take a look at the test defined below: | ||
Laravel 提供了一個非常流暢的 API 來向您的應用程式發出 HTTP 請求並檢查輸出。如下面定義的測試: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Laravel 提供了一個非常流暢的 API 來向你的應用程式發出 HTTP 請求並檢查輸出。
http-tests.md
Outdated
@@ -23,7 +23,7 @@ Laravel provides a very fluent API for making HTTP requests to your application | |||
class ExampleTest extends TestCase | |||
{ | |||
/** | |||
* A basic test example. | |||
* 基本的測試範例。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一個基本測試範例。
http-tests.md
Outdated
@@ -35,19 +35,19 @@ Laravel provides a very fluent API for making HTTP requests to your application | |||
} | |||
} | |||
|
|||
The `get` method makes a `GET` request into the application, while the `assertStatus` method asserts that the returned response should have the given HTTP status code. In addition to this simple assertion, Laravel also contains a variety of assertions for inspecting the response headers, content, JSON structure, and more. | |||
`get` 方法會做一個 `GET` 請求給應用程式,而 `assertStatus` 方法來斷言所回傳的回應會有給定的 HTTP 狀態碼。除了這個簡易的斷言,Laravel 也包含用來檢查標頭、內容、JSON 結構等的各種斷言。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get
方法會建立一個GET
請求給應用程式- 除了這個簡易的斷言,Laravel 也包含用來檢查回應的 Header、內容、JSON 結構等的各種斷言。
http-tests.md
Outdated
- [Testing File Uploads](#testing-file-uploads) | ||
- [Available Assertions](#available-assertions) | ||
- [介紹](#introduction) | ||
- [自訂請求標頭](#customizing-request-headers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
自訂請求 Header
Header 保留原文比較直觀
http-tests.md
Outdated
|
||
<a name="customizing-request-headers"></a> | ||
### Customizing Request Headers | ||
### 自訂請求標頭 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
自訂請求的 Header
http-tests.md
Outdated
|
||
$this->actingAs($user, 'api') | ||
|
||
<a name="testing-json-apis"></a> | ||
## Testing JSON APIs | ||
## 測試 JSON APIs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
測試 JSON API
http-tests.md
Outdated
@@ -99,21 +99,21 @@ Of course, one common use of the session is for maintaining state for the authen | |||
} | |||
} | |||
|
|||
You may also specify which guard should be used to authenticate the given user by passing the guard name as the second argument to the `actingAs` method: | |||
你也可以指定用於認證給定的使用者 guard 名稱作為傳入 `actingAs` 方法的第二個參數: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你也可以透過將 guard 名稱作為第二個參數傳送給 actingAs
方法來指定應該使用那個守衛來驗證給定的使用者:
http-tests.md
Outdated
|
||
<?php | ||
|
||
class ExampleTest extends TestCase | ||
{ | ||
/** | ||
* A basic functional test example. | ||
* 基本的功能測試範例。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一個基本功能測試範例。
http-tests.md
Outdated
|
||
<?php | ||
|
||
class ExampleTest extends TestCase | ||
{ | ||
/** | ||
* A basic functional test example. | ||
* 基本的功能測試範例。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一個基本功能測試範例。
http-tests.md
Outdated
|
||
UploadedFile::fake()->image('avatar.jpg', $width, $height)->size(100); | ||
|
||
In addition to creating images, you may create files of any other type using the `create` method: | ||
除了建立圖像,你可以使用 `create` 方法來建立任何類型的檔案: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
除了建立圖片,你可以使用 create
方法來建立任何類型的檔案:
Translate
http-tests.md
(v5.5)已同步原始文件在 11/9 之前的新增內容