my code is as follows:
class DailyUsageCommandTest extends TestCase
{
public function testDailyUsageCommandTest()
{
$this->artisan('daily-usage')->assertExitCode(0);
}
}
But it throws:
1) DailyUsageCommandTest::testDailyUsageCommandTest Error: Call to a member function assertExitCode() on int
The error is saying that $this->artisan('daily-usage') returns an int (Call to a member function assertExitCode() on int). So you have to store the result and do assertTrue with your value like this:
$result = $this->artisan('daily-usage');
$this->assertTrue($result === 0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With