Skip to content

Instantly share code, notes, and snippets.

@geshan
Created March 19, 2021 02:31
Show Gist options
  • Select an option

  • Save geshan/89866b3bed39e314bdee6eab3823e60f to your computer and use it in GitHub Desktop.

Select an option

Save geshan/89866b3bed39e314bdee6eab3823e60f to your computer and use it in GitHub Desktop.
Markdium-5 useful PHPUnit Assertions you should start using now
public function testAssertArrayHasKey()
{
$exchangeRates = ['usd' => 0.77, 'euro' => 0.63];
$this->assertArrayHasKey('usd', $exchangeRates, 'Check if USD is available');
$this->assertEquals(0.77, $exchangeRates['usd'], 'Test if USD rate is 0.77');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment