Last active
May 24, 2021 17:23
-
-
Save sameernyaupane/1ee74e84b5639cc808da18e7f507e101 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Tests\Unit; | |
use App\Math; | |
use Mockery as m; | |
use Mockery\Adapter\Phpunit\MockeryTestCase; | |
class MathTest extends MockeryTestCase | |
{ | |
public function setUp() | |
{ | |
$this->calculate = m::mock('App\Calculate'); | |
$this->math = new Math($this->calculate); | |
} | |
public function test_getArea_WhenCalledWithLength2_Return4() | |
{ | |
$this->calculate->shouldReceive('areaOfSquare') | |
->andReturn(4) | |
->once(); | |
$length = 2; | |
$response = $this->math->getArea($length); | |
$this->assertTrue(is_int($response)); | |
$this->assertEquals(4, $response); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Forked and fixed bug, added
: void
to setUp