fromInt() public static method

public static fromInt ( integer $value, string $currency ) : Price
$value integer
$currency string
return Price
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);
 }
Beispiel #2
0
 function test_that_removes_product_from_stock()
 {
     $this->inventoryContext->commandBus()->handle(new CreateProduct('dumplie-sku-1', 20000, 'EUR', true));
     $this->inventoryContext->commandBus()->handle(new RemoveProductFromStock('dumplie-sku-1'));
     $this->clear();
     $product = $this->inventoryContext->products()->getBySku(new SKU('dumplie-sku-1'));
     $this->assertEquals(new Product(new SKU('dumplie-sku-1'), Price::fromInt(200, 'EUR'), false), $product);
 }
Beispiel #3
0
 function it_can_be_puting_back_to_stock()
 {
     $this->removeFromStock();
     $this->putBackToStock();
     $this->shouldBeLike(new Product(new SKU("DUMPLIE_SKU_1"), Price::fromInt(250, 'PLN'), $isInStock = true));
 }
 public function test_that_put_back_product_with_given_sku_to_stock()
 {
     $this->putBackProductToStockHandler->handle(new PutBackProductToStock('dumplie_sku_1'));
     $product = $this->products->getBySku(new SKU('dumplie_sku_1'));
     $this->assertEquals(new Product(new SKU('dumplie_sku_1'), Price::fromInt(2000, 'EUR'), true), $product);
 }
 public function test_that_remove_product_with_given_sku_from_stock()
 {
     $this->removeProductFromStockHandler->handle(new RemoveProductFromStock('dumplie_sku_1'));
     $product = $this->products->getBySku(new SKU('dumplie_sku_1'));
     $this->assertEquals(new Product(new SKU('dumplie_sku_1'), Price::fromInt(2000, 'EUR'), false), $product);
 }