-
Notifications
You must be signed in to change notification settings - Fork 59
[EUV2][Datpn] Do Unit test homwork #31
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][Datpn] Do Unit test homwork #31
Conversation
2a54b5b to
b106eb1
Compare
b106eb1 to
c88b1a0
Compare
|
|
||
| $this->assertInstanceOf(ProductFactory::class, $product); | ||
| } | ||
| } No newline at end of file |
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.
á à
| $this->assertInstanceOf(ProductRepository::class, $repository); | ||
| } | ||
|
|
||
| public function test_all() |
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ái tên nên đặt xem test all này sucess hay fail j j đó ạ
| $this->checkoutRequest = new CheckoutRequest(); | ||
| } | ||
|
|
||
| public function test_contains_valid_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.
Anh ơi cái này nên có khi không cần test kiểu này mà mình sẽ test vào với controller để xem với trường hợp đúng thì response ok không. Với trường hợp request trueyefn vào sai có đúng redirect được đi không ạ.
Cái này mới chỉ là check mình viết có đúng cú pháp chưa thôi ạ
| $response->assertViewHas('products'); | ||
| } | ||
|
|
||
| public function test_checkout_success() |
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ái này anh thiếu check mấy case khi $paramRequest fail ạ
| $this->assertEquals($class, $response); | ||
| } | ||
|
|
||
| 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 nên chia case như bài 3 ấy ạ
Với lại thiếu case normal date trả về màu đen ạ
| $response->assertViewIs('exercise07::checkout.index'); | ||
| } | ||
|
|
||
| function test_store() |
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ũng tương tự anh test giúp em trường hợp validate fail nhé
| /** | ||
| * @dataProvider provideData | ||
| */ | ||
| public function test_calculate_shipping_fee($inputData, $expected) |
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.
Mình nên tách theo kiểu từng function với từng test case cho nó clear nhé anh. Không nên lạm dùng provider nhiều quá. Nếu dùng thì cũng comment từng case vào ạ.
Và nếu anh có hứng thú với C2 thì anh thử break thêm case xem sao ạ. Đây mới là C1. Không thì C1 là ok rồi ạ :D
Purpose/Notes
Screenshot
1.Module 3





1.Module 4
1.Module 6
1.Module 7
1.Module 9
Checklist (*)