Skip to content

Conversation

@giangnv-0040
Copy link

Purpose/Notes

Exercise03, Exercise04, Exercise05, Exercise06, Exercise07

Screenshot

image

Checklist (*)

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

use Modules\Exercise03\Repositories\ProductRepository;
use Illuminate\Database\Eloquent\Collection;

class ProductServiceTest extends TestCase
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ở đây thiếu miss mất 1 case.
Giả sử các trường hợp dưới đây không tồn tại thì ra sao?

$totalProducts[Product::CRAVAT_TYPE] 
$totalProducts[Product::OTHER_TYPE]
$totalProducts[Product::WHITE_SHIRT_TYPE]

Ngoài thì cũng nên để ý các trương logic so sánh >= hiện tại chỉ đang test các trường hợp > nhưng đối với các trường hợp = thì đang không test

Comment on lines +25 to +58
function test_index()
{
$calendars = [];
$j = 0;
$holidays = ['2020-09-26'];

$url = action([Exercise::class, 'index']);
$dummyClass = 'class';

for ($i = 1; $i <= 30; $i++) {
$date = \Carbon\Carbon::createFromDate(2020, 9, $i);

$this->serviceMock
->shouldReceive('getDateClass')
->andReturn($dummyClass);

$calendars[$j][] = [
'label' => $i,
'date' => $date,
'class' => $dummyClass,
];

if ($i % 7 == 0) {
$j++;
}
}

$response = $this->get($url);

$response->assertViewIs('exercise04::calendar');
$response->assertViewHasAll([
'calendars',
]);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Đoạn này viết đơn giản thui ạ, không cần phải logic phức tạp như này đâu.
Anh chỉ cần assert data của calendars là đc, không cần phải viết logic để tạo ra cái data đấy ạ

use InvalidArgumentException;
use Modules\Exercise05\Services\OrderService;

class OrderServiceTest extends TestCase
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Các case logic >= thì hiện tại anh chỉ viết test cho các logic > còn các logic = thì hiện tại chưa thấy test

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