public function testToArray() { $productMock = $this->generateProductMock(self::PRODUCT_ID, self::PRODUCT_TYPE, self::PRODUCT_SKU, self::PRODUCT_NAME, self::PRODUCT_WEIGHT, self::PRODUCT_TAX_CLASS_ID, self::PRODUCT_COST); $this->model->setProduct($productMock); $toArrayValue = ['a' => 'b']; $productMock->expects($this->once())->method('toArray')->will($this->returnValue($toArrayValue)); $data = $this->model->toArray(); $this->assertEquals($toArrayValue, $data['product']); }