Dumplie\SharedKernel\Domain\Money\Price::fromInt PHP Method

fromInt() public static method

public static fromInt ( integer $value, string $currency ) : Price
$value integer
$currency string
return Price
    public static function fromInt(int $value, string $currency) : Price
    {
        return new self($value * self::DEFAULT_PRECISION, $currency);
    }

Usage Example

Beispiel #1
0
 function it_sums_products_with_same_sku()
 {
     $this->add(new Product(new SKU("DUMPLIE_SKU_1"), Price::fromInt(100, 'EUR'), true), 1);
     $this->add(new Product(new SKU("DUMPLIE_SKU_1"), Price::fromInt(100, 'EUR'), true), 4);
     $this->isEmpty()->shouldReturn(false);
     $this->items()->shouldHaveCount(1);
     $this->items()["DUMPLIE_SKU_1"]->quantity(5);
 }
All Usage Examples Of Dumplie\SharedKernel\Domain\Money\Price::fromInt