Ejemplo n.º 1
0
 /**
  * @dataProvider dataProviderProducts
  */
 public function testPossuiUmaColecaoAttributes(Product $product)
 {
     foreach ($product->getAttributes() as $attribute) {
         $this->assertInstanceOf(Attribute::class, $attribute);
     }
 }
Ejemplo n.º 2
0
 /**
  * @testdox ``Traduz sem perder informação de preço``
  * @cover ::translateFrom
  * @cover ::translateTo
  * @dataProvider dataProviderArrayExpected
  * @test
  */
 public function translateViceVersa($expected)
 {
     $sku = $expected['skus'][0];
     $product = new Product($expected);
     $assertNative = function ($first, $o, $i = 1) use($sku) {
         $o->assertSame($sku['listPrice'], $first->getPrice()->getPrice(), 'n)listPrice #' . $i);
         $o->assertSame($sku['sellPrice'], $first->getPriceSchedule()->getPriceTo(), 'n)sellPrice #' . $i);
         $o->assertSame($sku['stock'], $first->getStock()->getAvailable(), 'n)stock #' . $i);
         $o->assertSame($sku['status'], $first->getStatus()->getActive(), 'n)status #' . $i);
     };
     $assertForeign = function ($foreign, $o) use($sku) {
         $o->assertSame($sku['listPrice'], $foreign->get('skus')[0]['listPrice'], 'f)listPrice');
         $o->assertSame($sku['sellPrice'], $foreign->get('skus')[0]['sellPrice'], 'f)sellPrice');
         $o->assertSame($sku['stock'], $foreign->get('skus')[0]['stock'], 'f)stock');
         $o->assertSame($sku['status'], $foreign->get('skus')[0]['status'], 'f)status');
     };
     $assertNative($product->getSkus()->first(), $this);
     $translator = new Translator(['native' => $product]);
     $foreign = $translator->translateTo();
     $assertForeign($foreign, $this);
     $translator->setForeign($foreign);
     $translated = $translator->translateFrom();
     $assertNative($translated->getSkus()->first(), $this, 2);
 }
Ejemplo n.º 3
0
 public function displayProduct(Product $p, OutputInterface $output)
 {
     $this->displayTableResults($output, [['Id' => $p->getProductId(), 'Brand' => $p->getBrand(), 'Department' => $p->getDepartment(), 'Product Type' => $p->getProductType()]]);
     $output->writeln('<fg=yellow>Skus</>');
     $this->displayTableResults($output, $p->getSkus());
 }