davy_yg's avatar
Level 27

OK (1 test, 1 assertion)

When performing php unit test we often see this kind of message:

OK (1 test, 1 assertion)

ref: https://laravel.com/docs/8.x/testing#environment

What I don't understand does that assertion only appears everytime we write these codes:

$this->assertTrue($quiz->isComplete());
$this->assertFalse($quiz->isComplete());
$this->assertEquals(0, $quiz-grade());

So are these three assertions ?

0 likes
13 replies
Sinnbeck's avatar

Yep those are assertions.. The method is the test and everything you ask phpunit to assert, are assertions..

It is even in the name assertFalse()

davy_yg's avatar
Level 27

OK (9 test, 7 assertion)

Does it means 9 functions ?

Sinnbeck's avatar

@davy_yg Are some of the tests marked as skipped? Normally each test would have a minimum of 1 assertion. Can you perhaps show the 9 tests?

davy_yg's avatar
Level 27

So is this make more sense:

OK (7 test, 9 assertion)

I forget which is which but I copy paste from the laracasts tutorials. So is this means 7 functions and 9 assertions ?

davy_yg's avatar
Level 27

I thought it still within the same theme, then I should change the title. I normally have several questions within the same topic.

Sinnbeck's avatar

@davy_yg The problem is that if anyone searched laracasts for "what does assertions mean" they will find this thread and the answer will be something that isnt related at all.. Why is it hard for you to create a new topic for each of your problems?

Please or to participate in this conversation.