Skip to content

Commit

Permalink
Vastly improves tests.
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed May 28, 2018
1 parent 9523d2c commit e5389f5
Showing 1 changed file with 75 additions and 2 deletions.
77 changes: 75 additions & 2 deletions tests/MYRTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,87 @@ public function it_can_be_get_currency_information()
}

/** @test */
public function it_can_be_equaled()
public function it_can_determine_is_equals()
{
$money = new MYR(500);
$compared = Money::MYR(500);

$stub = $money->equals($compared);

$this->assertSame('2000', $stub->getAmount());
$this->assertTrue($stub);

$this->assertFalse((new MYR(500))->equals(new MYR(300)));
}

/** @test */
public function it_can_determine_is_same_currency()
{
$money = new MYR(500);
$compared = Money::MYR(800);

$stub = $money->isSameCurrency($compared);

$this->assertTrue($stub);

$money = new MYR(500);
$compared = Money::USD(800);

$stub = $money->isSameCurrency($compared);

$this->assertFalse($stub);
}

/** @test */
public function it_can_determine_is_less_than()
{
$money = new MYR(500);
$compared = Money::MYR(1000);

$stub = $money->lessThan($compared);

$this->assertTrue($stub);

$this->assertFalse((new MYR(1000))->lessThan(new MYR(500)));
}

/** @test */
public function it_can_determine_is_less_than_or_equals()
{
$money = new MYR(500);
$compared = Money::MYR(500);

$stub = $money->lessThanOrEqual($compared);

$this->assertTrue($stub);

$this->assertFalse((new MYR(501))->equals(new MYR(500)));
}


/** @test */
public function it_can_determine_is_greater_than()
{
$money = new MYR(1000);
$compared = Money::MYR(500);

$stub = $money->greaterThan($compared);

$this->assertTrue($stub);

$this->assertFalse((new MYR(500))->greaterThan(new MYR(1000)));
}

/** @test */
public function it_can_determine_is_greater_than_or_equals()
{
$money = new MYR(500);
$compared = Money::MYR(500);

$stub = $money->greaterThanOrEqual($compared);

$this->assertTrue($stub);

$this->assertFalse((new MYR(500))->greaterThanOrEqual(new MYR(501)));
}

/** @test */
Expand Down

0 comments on commit e5389f5

Please sign in to comment.