-
Notifications
You must be signed in to change notification settings - Fork 59
[EUV2][TuanVH] Create UT for [Exercise03 ~ Exercise07] #40
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?
[EUV2][TuanVH] Create UT for [Exercise03 ~ Exercise07] #40
Conversation
4beb3f7
to
aa76722
Compare
$this->assertEquals($class, $expectValue); | ||
} | ||
|
||
public function provideData() |
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.
Anh ơi với bài này thì em nghĩ nên tách mỗi case ra một hàm để còn xem là với trường hợp ngày lễ có đúng màu đỏ, với ngày cn có đúng màu đỏ, .v.v. Ý là cho meaning hơn ấy ạ.
Với anh thiếu case ngày thường color là BLACK ạ
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.
- trong provideData có $expectValue rồi, a nghĩ cũng k cần thiết phải tách ra nhiều func đâu
- case: color Black a update rồi nhé
$this->controller = new Exercise05Controller($this->mockOrderService); | ||
} | ||
|
||
public function testIndex() |
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ên function nên thể hiện được a test case nào và expect của test case của test case a nhé
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.
a thấy k cần thiết sửa đâu, ở đây mình đang test theo file, theo method mà,
Sau muốn update file test, vào file test mình thấy rõ hơn đang đã viết test cho những method nào rồi
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.
Việc đặt tên nó khá quan trọng ạ . Đây là case đơn giản thì mình có thể viết ngẵn gọn được
Nhưng với nhiều case phức tạp thì cách đặt tên nó sẽ giúp bản thân mình đọc code dễ dàng hơn
trong case này e thấy tên ntn là hợp lý ạ
test_index_return_view_success
public function testHandleDiscount($detailOrder, $expectValue) | ||
{ | ||
$response = $this->orderService->handleDiscount($detailOrder); | ||
//print_r($response); |
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.
code ko cần thiết thì xóa đi a nhé
Purpose/Notes
Screenshot
Checklist (*)