I want to ensure user's card has enough balance before proceeding with checkout. Below is the test class:
declare(strict_types=1);
use PHPUnit\Framework\TestCase;
class PaymentTest extends TestCase
{
/**
* @dataProvider cardBalance
*/
public function testAccountHasBalance($amount)
{
$this->assertGreaterThan(0,$amount);
}
/**
* @depends testAccountHasBalance
*/
public function testCheckout()
{
$this->assertTrue(true);
}
public function cardBalance()
{
return 100;
}
}
The two tests are being skipped and marked as incomplete or risky. What am missing?
@kenprogrammer good stuff. how to write tests is a bit of an art but its worth getting to grips with as it'll give you much more confidence with refactoring.
my favourite phrase for this is 'your future self will thank you' :)