Skip to content

Instantly share code, notes, and snippets.

@sameernyaupane
Created November 6, 2018 03:26
Show Gist options
  • Save sameernyaupane/c356fe1373c28132d59c33194a1e12c4 to your computer and use it in GitHub Desktop.
Save sameernyaupane/c356fe1373c28132d59c33194a1e12c4 to your computer and use it in GitHub Desktop.
<?php
namespace Tests\Integration;
use Tests\TestCase;
class MathTest extends TestCase
{
public function setUp()
{
parent::setUp();
$this->math = $this->app->make('App\Math');
}
public function test_getArea_WhenCalledWithLength2_Return4()
{
$response = $this->math->getArea(2);
$this->assertTrue(is_int($response));
$this->assertEquals(4, $response);
}
public function test_getArea_WhenCalledWithLength6_Return36()
{
$length = 6;
$response = $this->math->getArea($length);
$this->assertTrue(is_int($response));
$this->assertEquals(36, $response);
}
public function test_getArea_WhenCalledWithoutLength_ThrowAnException()
{
$this->expectException('ArgumentCountError');
$this->expectExceptionMessage('Too few arguments to function');
$this->math->getArea();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment