Sonata\Tests\Component\Product\BaseProductServiceTest::testArrayProduct PHP Method

testArrayProduct() public method

public testArrayProduct ( )
    public function testArrayProduct()
    {
        $product = new Product();
        $arrayProduct = array('sku' => 'productSku', 'slug' => 'productslug', 'name' => 'productName', 'description' => 'productDescription', 'rawDescription' => 'productRawDescription', 'descriptionFormatter' => 'productDescriptionFormatter', 'shortDescription' => 'productShortDescription', 'rawShortDescription' => 'productRawShortDescription', 'shortDescriptionFormatter' => 'productShortDescriptionFormatter', 'price' => 123.45, 'vatRate' => 678.9, 'stock' => 12345, 'enabled' => 1, 'options' => array('key1' => 'value1', 'key2' => array('value2', 'value3')));
        $product->fromArray($arrayProduct);
        $this->assertEquals($arrayProduct, $product->toArray());
        $this->assertEquals($product->getSku(), $arrayProduct['sku']);
        $this->assertEquals($product->getSlug(), $arrayProduct['slug']);
        $this->assertEquals($product->getName(), $arrayProduct['name']);
        $this->assertEquals($product->getDescription(), $arrayProduct['description']);
        $this->assertEquals($product->getRawDescription(), $arrayProduct['rawDescription']);
        $this->assertEquals($product->getDescriptionFormatter(), $arrayProduct['descriptionFormatter']);
        $this->assertEquals($product->getShortDescription(), $arrayProduct['shortDescription']);
        $this->assertEquals($product->getRawShortDescription(), $arrayProduct['rawShortDescription']);
        $this->assertEquals($product->getShortDescriptionFormatter(), $arrayProduct['shortDescriptionFormatter']);
        $this->assertEquals($product->getPrice(), $arrayProduct['price']);
        $this->assertEquals($product->getVatRate(), $arrayProduct['vatRate']);
        $this->assertEquals($product->getStock(), $arrayProduct['stock']);
        $this->assertEquals($product->getEnabled(), $arrayProduct['enabled']);
        $this->assertEquals($product->getOptions(), $arrayProduct['options']);
    }