-
-
Save tim-andes/f53b075a4d43e46510a69ce018546467 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(): void | |
{ | |
$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