-
Notifications
You must be signed in to change notification settings - Fork 59
Sontt - do homework #12
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
base: master
Are you sure you want to change the base?
Sontt - do homework #12
Conversation
b03bce1 to
7129299
Compare
|
@sontt-1215 |
7129299 to
4b83d72
Compare
4b83d72 to
f6105d7
Compare
f11dac6 to
a203689
Compare
| protected function setUp(): void | ||
| { | ||
| parent::setUp(); | ||
| $this->rules = (new OrderRequest())->rules(); |
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.
indent e ơi
|
|
||
| public function testPrice() | ||
| { | ||
| $this->assertTrue($this->validateField('price', 1200)); |
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.
cần test cả những case fail nữa e nhé
| $this->assertTrue($this->validateField('option_receive', '1')); | ||
| } | ||
|
|
||
| public function testOptionCoupoin() |
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.
testOptionCoupoin ==> sai chính tả này
| [ | ||
| 'price' => 1280, | ||
| 'discount_pizza' => null, | ||
| 'discount_potato' => 'Miễn phí khoai tây', |
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.
những cái gì đã có trong config mình nên dùng e nhé
Chứ hash code các giá trị trong config thì sau này sửa thì update mệt nghỉ
| /** | ||
| * @dataProvider providerTestHandleDiscount | ||
| */ | ||
| public function testHandleDiscount($input, $expect) |
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.
Sử dụng dataProvider rất hay đấy nhưng a bản chât thì Unitest nó là tài liệu cho mình
Nên a nghĩ ở đây nên break các hàm ra để có thể rõ ràng được xem
- Test hàm gì ?
- Kết quả là gi ?
==> Để sau này đọc cái là hiểu ngay tránh trường hợp bẵng đi một thời gian là quên sạch
Và làm việc trong team thì người khác đọc vào hiểu ngay dụng ý của chú test case này làm gì , đỡ tốn thời gian transfer .
Có thể tham khảo ở https://sun-unit-test-training.github.io/php-testing-guideline/06-checklist/ e nhé
| protected function setUp(): void | ||
| { | ||
| parent::setUp(); | ||
| $this->rules = (new Exercise06Request())->rules(); |
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.
tương tự bài 5 e nhé
| public function testCalculatePass($input, $expect) | ||
| { | ||
| $service = new CalculateService; | ||
| $response = $service->calculate($input, true); |
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.
tương tự bài 5 e nhé
|
Config chạy CI như mọi người đi em |
Purpose/Notes
Screenshot
(UI, coverage screenshot?)





Ex3:
EX4:
EX5:
EX6:
EX7:
Checklist (*)
- [ ] Pull request has been self-reviewed