Skip to content

Conversation

@sontt-1215
Copy link

@sontt-1215 sontt-1215 commented Apr 15, 2021

Purpose/NotesScreenshot from 2021-04-19 14-36-29

Screenshot

(UI, coverage screenshot?)
Ex3:
Screenshot from 2021-04-15 16-54-46
EX4:
Screenshot from 2021-04-19 10-35-15
EX5:
Screenshot from 2021-04-19 12-44-34
EX6:
Screenshot from 2021-04-19 14-36-29
EX7:
Screenshot from 2021-04-19 14-49-02

Checklist (*)Screenshot from 2021-04-19 14-36-29- [ ] Pull request has been self-reviewed

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All CI builds passed successfully (all builds are green)

@sontt-1215 sontt-1215 force-pushed the tran_thanh_son_do_homework branch 2 times, most recently from b03bce1 to 7129299 Compare April 15, 2021 10:01
@namnhp-2137
Copy link

@sontt-1215
Tổng quan thì khá là oke anh ơi, tuy 1 số test bị leak 1 - 2 case thôi.
Với lại là viết test cái gì thì new cái đó, chứ không nên dùng IOC trong test.

@sontt-1215 sontt-1215 force-pushed the tran_thanh_son_do_homework branch from 7129299 to 4b83d72 Compare April 16, 2021 02:01
@sontt-1215 sontt-1215 force-pushed the tran_thanh_son_do_homework branch from 4b83d72 to f6105d7 Compare April 19, 2021 02:40
@sontt-1215 sontt-1215 force-pushed the tran_thanh_son_do_homework branch from f11dac6 to a203689 Compare April 19, 2021 07:36
protected function setUp(): void
{
parent::setUp();
$this->rules = (new OrderRequest())->rules();

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));

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()

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',

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)

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();

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);

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é

@anhnv-0443
Copy link

Config chạy CI như mọi người đi em

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants