本文整理汇总了PHP中Money\Money::MXN方法的典型用法代码示例。如果您正苦于以下问题:PHP Money::MXN方法的具体用法?PHP Money::MXN怎么用?PHP Money::MXN使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Money\Money
的用法示例。
在下文中一共展示了Money::MXN方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: JsonSerializer
/** @test */
function it_should_serialize_a_domain_event_to_json()
{
$serializer = new JsonSerializer();
$anEvent = new InstantaneousEvent(Identifier::fromString('abc'), Money::MXN(10000), new DateTime('2015-10-24 12:39:51'));
$json = $serializer->serialize($anEvent);
$this->assertEquals('{"occurred_on":"2015-10-24 12:39:51","member_id":"abc","amount":10000}', $json, 'JSON format for serialized event is incorrect');
}
示例2:
/** @test */
function it_should_update_the_information_of_a_registered_member()
{
$member = $this->members->with(Identifier::fromString('wxyz'));
$member->transfer(Money::MXN(500), $this->existingMember);
$this->members->update($this->existingMember);
$this->assertBalanceAmounts(3500, $this->existingMember, "Current member balance should be 3500");
}
示例3: __construct
/**
* @param string $fromMemberId
* @param string $amount
* @param string $toMemberId
* @param string $occurredOn
*/
public function __construct($fromMemberId, $amount, $toMemberId, $occurredOn)
{
$this->occurredOn = DateTime::createFromFormat('Y-m-d H:i:s', $occurredOn);
$this->fromMemberId = Identifier::fromString($fromMemberId);
$this->amount = Money::MXN($amount);
$this->toMemberId = Identifier::fromString($toMemberId);
}
示例4:
/** @test */
function beneficiary_balance_should_increase_after_funds_have_been_transferred()
{
$this->forAll(Generator\int(1, 10000))->then(function ($amount) {
$fromMember = A::member()->withBalance(10000)->build();
$toMember = A::member()->withBalance(5000)->build();
$fromMember->transfer(Money::MXN($amount), $toMember);
$this->assertBalanceIsGreaterThan(5000, $toMember, "Transferring {$amount} increased balance of receiver member");
});
}
示例5: InMemory
/** @test */
function it_should_send_deposit_received_email()
{
$template = Mockery::mock(TemplateEngine::class);
$template->shouldReceive('render')->once()->with(Mockery::type('string'), Mockery::type('array'));
$transport = new InMemory();
$sender = new TransferFundsZendMailSender($template, $transport);
$sender->sendDepositReceivedEmail(A::member()->build()->information(), A::member()->withEmail('montealegreluis@gmail.com')->build()->information(), Money::MXN(500), new DateTime());
$this->assertEquals('montealegreluis@gmail.com', $transport->getLastMessage()->getTo()->current()->getEmail(), 'Address doesn\'t belong to the member receiving the deposit');
$this->assertRegExp('/received.*deposit/', $transport->getLastMessage()->getSubject(), 'Email\'s subject is wrong');
}
示例6: InstantaneousEvent
/** @test */
function it_should_create_an_stored_event_from_a_given_domain_event()
{
$event = new InstantaneousEvent(Identifier::fromString('abc'), Money::MXN(500000), new DateTime('2015-10-25 19:59:00'));
$factory = new StoredEventFactory(new JsonSerializer());
$storedEvent = $factory->from($event);
// Stored events get an ID after being persisted
$this->assertEquals(null, $storedEvent->id());
$this->assertEquals('{"occurred_on":"2015-10-25 19:59:00","member_id":"abc","amount":500000}', $storedEvent->body());
$this->assertEquals(InstantaneousEvent::class, $storedEvent->type());
$this->assertEquals('2015-10-25 19:59:00', $storedEvent->occurredOn()->format('Y-m-d H:i:s'));
}
示例7: reset
protected function reset()
{
$this->name = $this->faker->name;
$this->email = $this->faker->email;
$this->amount = Money::MXN($this->faker->numberBetween(0, 10000));
$this->id = $this->faker->uuid;
}
示例8: PersistEventsSubscriber
/** @test */
function it_should_subscribe_to_all_event_types()
{
$subscriber = new PersistEventsSubscriber(Mockery::mock(EventStore::class), Mockery::mock(StoredEventFactory::class));
$this->assertTrue($subscriber->isSubscribedTo(new InstantaneousEvent(Identifier::any(), Money::MXN(100000), new DateTime('now'))));
$this->assertTrue($subscriber->isSubscribedTo(A::transferWasMadeEvent()->build()));
}
示例9:
function it_should_not_allow_withdrawing_more_than_the_current_balance()
{
$this->beConstructedThrough('withBalance', [Money::MXN(3000)]);
$this->shouldThrow(InsufficientFunds::class)->duringWithdraw(Money::MXN(3500));
}
示例10:
/** @test */
function it_should_format_a_money_object_information()
{
$this->assertEquals('$5,987.29 MXN', $this->formatter->formatMoney(Money::MXN(598729)));
}
示例11: build
/**
* @return TransferWasMade
*/
public function build()
{
$event = new TransferWasMade(Identifier::fromString($this->fromId), Money::MXN($this->amount), Identifier::fromString($this->toId));
$this->reset();
return $event;
}
示例12:
function it_should_record_that_a_transfer_was_made()
{
$this->transfer(Money::MXN(500), A::member()->build());
$this->events()->count()->shouldBe(1);
}
示例13: __construct
/**
* @param array $filteredInput
*/
private function __construct(array $filteredInput)
{
$this->fromMemberId = Identifier::fromString($filteredInput['fromMemberId']);
$this->toMemberId = Identifier::fromString($filteredInput['toMemberId']);
$this->amount = Money::MXN((int) ($filteredInput['amount'] * 100));
}
示例14: isBalanceAmountGreaterThan
/**
* @param integer $lowerLimit
* @return AmountLowerThanConstraint
*/
public static function isBalanceAmountGreaterThan($lowerLimit)
{
return new AmountGreaterThanConstraint(Money::MXN((int) $lowerLimit));
}
示例15:
/** @test */
function it_should_delegate_formatting_a_money_object()
{
$this->extension->formatMoney($amount = Money::MXN(300000));
$this->formatter->shouldHaveReceived('formatMoney')->once()->with($amount);
}