Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace Magento\Elasticsearch\Test\Unit\Model\ResourceModel; use Magento\Catalog..

Decoded Output download

<?php
  namespace Magento\Elasticsearch\Test\Unit\Model\ResourceModel; use Magento\Catalog\Api\CategoryRepositoryInterface; use Magento\Catalog\Api\Data\CategoryInterface; use Magento\Catalog\Api\Data\ProductAttributeInterface; use Magento\Catalog\Api\Data\ProductInterface; use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Model\Indexer\Product\Price\DimensionCollectionFactory; use Magento\CatalogSearch\Model\ResourceModel\Fulltext; use Magento\Eav\Model\Config; use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; use Magento\Eav\Model\Entity\Attribute\Option; use Magento\Elasticsearch\Model\ResourceModel\Index; use Magento\Framework\App\ResourceConnection; use Magento\Framework\DB\Adapter\AdapterInterface; use Magento\Framework\DB\Select; use Magento\Framework\EntityManager\MetadataPool; use Magento\Framework\Event\ManagerInterface; use Magento\Framework\Indexer\MultiDimensionProvider; use Magento\Framework\Indexer\ScopeResolver\IndexScopeResolver; use Magento\Framework\Model\ResourceModel\Db\AbstractDb; use Magento\Framework\Model\ResourceModel\Db\Context; use Magento\Framework\Search\Request\IndexScopeResolverInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; use Magento\Store\Api\Data\StoreInterface; use Magento\Store\Model\StoreManagerInterface; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class IndexTest extends TestCase { private $model; protected $storeManager; protected $productRepository; protected $categoryRepository; protected $eavConfig; protected $fullText; protected $context; protected $eventManager; protected $metadataPool; protected $product; protected $category; protected $productAttributeInterface; protected $connection; protected $select; protected $resources; protected $storeInterface; protected $tableResolver; protected function setUp() : void { $this->storeManager = $this->getMockBuilder(StoreManagerInterface::class)->disableOriginalConstructor()->onlyMethods(array("getStore"))->getMockForAbstractClass(); $this->storeInterface = $this->getMockBuilder(StoreInterface::class)->disableOriginalConstructor()->onlyMethods(array("getWebsiteId"))->getMockForAbstractClass(); $this->productRepository = $this->getMockBuilder(ProductRepositoryInterface::class)->getMockForAbstractClass(); $this->categoryRepository = $this->getMockBuilder(CategoryRepositoryInterface::class)->getMockForAbstractClass(); $this->eavConfig = $this->getMockBuilder(Config::class)->disableOriginalConstructor()->onlyMethods(array("getEntityAttributeCodes", "getAttribute"))->getMock(); $this->fullText = $this->getMockBuilder(Fulltext::class)->disableOriginalConstructor()->getMock(); $this->context = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->onlyMethods(array("getTransactionManager", "getResources", "getObjectRelationProcessor"))->getMock(); $this->eventManager = $this->getMockBuilder(ManagerInterface::class)->onlyMethods(array("dispatch"))->getMockForAbstractClass(); $this->product = $this->getMockBuilder(ProductInterface::class)->disableOriginalConstructor()->addMethods(array("getData"))->getMockForAbstractClass(); $this->category = $this->getMockBuilder(CategoryInterface::class)->disableOriginalConstructor()->onlyMethods(array("getName"))->getMockForAbstractClass(); $this->connection = $this->getMockBuilder(AdapterInterface::class)->disableOriginalConstructor()->getMockForAbstractClass(); $this->select = $this->getMockBuilder(Select::class)->disableOriginalConstructor()->onlyMethods(array("distinct", "from", "join", "where", "orWhere"))->getMock(); $this->resources = $this->getMockBuilder(ResourceConnection::class)->disableOriginalConstructor()->onlyMethods(array("getConnection", "getTableName", "getTablePrefix"))->getMock(); $this->metadataPool = $this->getMockBuilder(MetadataPool::class)->disableOriginalConstructor()->addMethods(array("getIdentifierField"))->onlyMethods(array("getMetadata"))->getMock(); $this->context->expects($this->any())->method("getResources")->willReturn($this->resources); $this->resources->expects($this->any())->method("getConnection")->willReturn($this->connection); $this->resources->expects($this->any())->method("getTablePrefix")->willReturn(''); $this->metadataPool->method("getMetadata")->willReturnSelf(); $this->metadataPool->method("getIdentifierField")->willReturn("entity_id"); $objectManager = new ObjectManagerHelper($this); $connection = $this->getMockBuilder(AdapterInterface::class)->disableOriginalConstructor()->getMockForAbstractClass(); $resource = $this->getMockBuilder(ResourceConnection::class)->onlyMethods(array("getConnection", "getTableName"))->disableOriginalConstructor()->getMock(); $resource->expects($this->any())->method("getConnection")->willReturn($connection); $resource->expects($this->any())->method("getTableName")->willReturnArgument(0); $this->tableResolver = $objectManager->getObject(IndexScopeResolver::class, array("resource" => $resource)); $traversableMock = $this->createMock(\Traversable::class); $dimensionsMock = $this->createMock(MultiDimensionProvider::class); $dimensionsMock->method("getIterator")->willReturn($traversableMock); $indexScopeResolverMock = $this->createMock(IndexScopeResolverInterface::class); $dimensionFactoryMock = $this->createMock(DimensionCollectionFactory::class); $dimensionFactoryMock->method("create")->willReturn($dimensionsMock); $indexScopeResolverMock->method("resolve")->willReturn("catalog_product_index_price"); $this->model = $objectManager->getObject(Index::class, array("context" => $this->context, "storeManager" => $this->storeManager, "metadataPool" => $this->metadataPool, "productRepository" => $this->productRepository, "categoryRepository" => $this->categoryRepository, "eavConfig" => $this->eavConfig, "connectionName" => "default", "tableResolver" => $this->tableResolver, "dimensionCollectionFactory" => $dimensionFactoryMock)); } public function testGetPriceIndexData() { $connection = $this->connection; $select = $this->select; $connection->expects($this->any())->method("select")->willReturn($select); $select->expects($this->any())->method("from")->willReturnSelf(); $connection->expects($this->once())->method("fetchAll")->with($select)->willReturn(array(array("website_id" => 1, "entity_id" => 1, "customer_group_id" => 1, "min_price" => 1))); $this->storeManager->expects($this->once())->method("getStore")->willReturn($this->storeInterface); $this->storeInterface->expects($this->once())->method("getWebsiteId")->willReturn(1); $this->assertEquals(array(1 => array(1 => 1)), $this->model->getPriceIndexData(array(1), 1)); } public function testGetPriceIndexDataEmpty() { $connection = $this->connection; $select = $this->select; $connection->expects($this->any())->method("select")->willReturn($select); $select->expects($this->any())->method("from")->willReturnSelf(); $connection->expects($this->once())->method("fetchAll")->with($select)->willReturn(array()); $this->storeManager->expects($this->once())->method("getStore")->willReturn($this->storeInterface); $this->storeInterface->expects($this->once())->method("getWebsiteId")->willReturn(1); $this->assertEquals(array(), $this->model->getPriceIndexData(array(1), 1)); } public function testGetCategoryProductIndexData() { $connection = $this->connection; $select = $this->select; $connection->expects($this->any())->method("select")->willReturn($select); $select->expects($this->any())->method("from")->with(array("catalog_category_product_index_store1"), array("category_id", "product_id", "position", "store_id"))->willReturnSelf(); $select->expects($this->any())->method("where")->willReturnSelf(); $connection->expects($this->once())->method("fetchAll")->with($select)->willReturn(array(array("product_id" => 1, "category_id" => 1, "position" => 1))); $this->assertEquals(array(1 => array(1 => 1)), $this->model->getCategoryProductIndexData(1, array(1))); } public function testGetMovedCategoryProductIds() { $connection = $this->connection; $select = $this->select; $connection->expects($this->any())->method("select")->willReturn($select); $select->expects($this->any())->method("distinct")->willReturnSelf(); $this->resources->expects($this->exactly(2))->method("getTableName"); $select->expects($this->any())->method("from")->willReturnSelf(); $select->expects($this->any())->method("join")->willReturnSelf(); $select->expects($this->any())->method("where")->willReturnSelf(); $select->expects($this->any())->method("orWhere")->willReturnSelf(); $connection->expects($this->once())->method("fetchCol")->with($select)->willReturn(array(1)); $this->assertEquals(array(1), $this->model->getMovedCategoryProductIds(1)); } public function testGetFullProductIndexData($frontendInput, $indexData) { $this->productRepository->expects($this->once())->method("getById")->willReturn($this->product); $this->product->expects($this->once())->method("getData")->willReturn(array("name" => "Product Name")); $this->eavConfig->expects($this->once())->method("getEntityAttributeCodes")->with("catalog_product")->willReturn(array("name")); $attributeMock = $this->getMockBuilder(AbstractAttribute::class)->disableOriginalConstructor()->onlyMethods(array("getFrontendInput", "getOptions", "getData", "getAttributeId"))->getMock(); $this->eavConfig->expects($this->once())->method("getAttribute")->with("catalog_product", "name")->willReturn($attributeMock); $attributeMock->expects($this->any())->method("getAttributeId")->willReturn(1); $attributeMock->expects($this->any())->method("getFrontendInput")->willReturn($frontendInput); $attributeOption = $this->createMock(Option::class); $attributeOption->expects($this->any())->method("getValue")->willReturn("240-LV04"); $attributeOption->expects($this->any())->method("getLabel")->willReturn("label"); $attributeMock->expects($this->any())->method("getOptions")->willReturn(array($attributeOption)); $this->assertIsArray($this->model->getFullProductIndexData(1, array(1 => $indexData))); } public function testGetFullCategoryProductIndexData() { $this->categoryRepository->expects($this->once())->method("get")->willReturn($this->category); $this->category->expects($this->once())->method("getName")->willReturn(array("name" => "Category Name")); $connection = $this->connection; $select = $this->select; $connection->expects($this->any())->method("select")->willReturn($select); $select->expects($this->any())->method("from")->willReturnSelf(); $select->expects($this->any())->method("where")->willReturnSelf(); $connection->expects($this->once())->method("fetchAll")->with($select)->willReturn(array(array("product_id" => 1, "category_id" => 1, "position" => 1))); $this->assertIsArray($this->model->getFullCategoryProductIndexData(1, array(1))); } public static function attributeCodeProvider() { return array(array("string", "240-LV04"), array("select", "240-LV04"), array("select", array(1)), array("select", array(1 => 1))); } } ?>

Did this file decode correctly?

Original Code

<?php
  namespace Magento\Elasticsearch\Test\Unit\Model\ResourceModel; use Magento\Catalog\Api\CategoryRepositoryInterface; use Magento\Catalog\Api\Data\CategoryInterface; use Magento\Catalog\Api\Data\ProductAttributeInterface; use Magento\Catalog\Api\Data\ProductInterface; use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Model\Indexer\Product\Price\DimensionCollectionFactory; use Magento\CatalogSearch\Model\ResourceModel\Fulltext; use Magento\Eav\Model\Config; use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; use Magento\Eav\Model\Entity\Attribute\Option; use Magento\Elasticsearch\Model\ResourceModel\Index; use Magento\Framework\App\ResourceConnection; use Magento\Framework\DB\Adapter\AdapterInterface; use Magento\Framework\DB\Select; use Magento\Framework\EntityManager\MetadataPool; use Magento\Framework\Event\ManagerInterface; use Magento\Framework\Indexer\MultiDimensionProvider; use Magento\Framework\Indexer\ScopeResolver\IndexScopeResolver; use Magento\Framework\Model\ResourceModel\Db\AbstractDb; use Magento\Framework\Model\ResourceModel\Db\Context; use Magento\Framework\Search\Request\IndexScopeResolverInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; use Magento\Store\Api\Data\StoreInterface; use Magento\Store\Model\StoreManagerInterface; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class IndexTest extends TestCase { private $model; protected $storeManager; protected $productRepository; protected $categoryRepository; protected $eavConfig; protected $fullText; protected $context; protected $eventManager; protected $metadataPool; protected $product; protected $category; protected $productAttributeInterface; protected $connection; protected $select; protected $resources; protected $storeInterface; protected $tableResolver; protected function setUp() : void { $this->storeManager = $this->getMockBuilder(StoreManagerInterface::class)->disableOriginalConstructor()->onlyMethods(array("\x67\145\164\123\164\x6f\162\145"))->getMockForAbstractClass(); $this->storeInterface = $this->getMockBuilder(StoreInterface::class)->disableOriginalConstructor()->onlyMethods(array("\147\145\x74\x57\145\x62\163\151\x74\145\111\x64"))->getMockForAbstractClass(); $this->productRepository = $this->getMockBuilder(ProductRepositoryInterface::class)->getMockForAbstractClass(); $this->categoryRepository = $this->getMockBuilder(CategoryRepositoryInterface::class)->getMockForAbstractClass(); $this->eavConfig = $this->getMockBuilder(Config::class)->disableOriginalConstructor()->onlyMethods(array("\x67\x65\x74\x45\x6e\164\x69\164\171\x41\x74\164\x72\x69\142\165\x74\x65\103\157\x64\x65\163", "\x67\145\164\101\164\x74\162\151\x62\x75\164\x65"))->getMock(); $this->fullText = $this->getMockBuilder(Fulltext::class)->disableOriginalConstructor()->getMock(); $this->context = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->onlyMethods(array("\147\145\x74\x54\x72\x61\x6e\x73\x61\x63\164\x69\157\x6e\115\x61\156\x61\147\145\162", "\x67\x65\164\x52\145\x73\157\165\162\143\x65\x73", "\147\x65\164\117\x62\152\x65\x63\x74\x52\145\x6c\141\x74\x69\x6f\x6e\x50\x72\x6f\143\145\x73\x73\x6f\x72"))->getMock(); $this->eventManager = $this->getMockBuilder(ManagerInterface::class)->onlyMethods(array("\x64\151\x73\160\141\x74\x63\x68"))->getMockForAbstractClass(); $this->product = $this->getMockBuilder(ProductInterface::class)->disableOriginalConstructor()->addMethods(array("\147\145\164\104\141\x74\141"))->getMockForAbstractClass(); $this->category = $this->getMockBuilder(CategoryInterface::class)->disableOriginalConstructor()->onlyMethods(array("\x67\145\x74\x4e\141\155\145"))->getMockForAbstractClass(); $this->connection = $this->getMockBuilder(AdapterInterface::class)->disableOriginalConstructor()->getMockForAbstractClass(); $this->select = $this->getMockBuilder(Select::class)->disableOriginalConstructor()->onlyMethods(array("\144\151\163\x74\x69\156\x63\164", "\x66\x72\x6f\x6d", "\x6a\x6f\151\156", "\167\150\145\162\145", "\157\x72\127\x68\x65\162\145"))->getMock(); $this->resources = $this->getMockBuilder(ResourceConnection::class)->disableOriginalConstructor()->onlyMethods(array("\x67\145\164\x43\x6f\x6e\156\145\x63\164\151\x6f\156", "\x67\x65\164\x54\141\142\x6c\x65\116\x61\155\x65", "\x67\x65\x74\124\x61\x62\154\145\x50\162\x65\146\151\170"))->getMock(); $this->metadataPool = $this->getMockBuilder(MetadataPool::class)->disableOriginalConstructor()->addMethods(array("\147\145\x74\111\144\145\x6e\164\151\146\x69\x65\162\x46\151\145\154\x64"))->onlyMethods(array("\x67\145\x74\115\145\164\141\x64\x61\164\x61"))->getMock(); $this->context->expects($this->any())->method("\147\145\x74\x52\145\163\x6f\165\x72\143\x65\163")->willReturn($this->resources); $this->resources->expects($this->any())->method("\147\145\x74\x43\x6f\156\156\x65\143\164\x69\x6f\x6e")->willReturn($this->connection); $this->resources->expects($this->any())->method("\147\x65\164\124\x61\x62\154\145\120\x72\145\146\151\170")->willReturn(''); $this->metadataPool->method("\x67\145\164\115\145\x74\141\x64\x61\x74\141")->willReturnSelf(); $this->metadataPool->method("\147\145\164\111\x64\145\x6e\164\151\146\x69\x65\162\106\151\x65\x6c\x64")->willReturn("\145\x6e\164\151\164\x79\x5f\x69\144"); $objectManager = new ObjectManagerHelper($this); $connection = $this->getMockBuilder(AdapterInterface::class)->disableOriginalConstructor()->getMockForAbstractClass(); $resource = $this->getMockBuilder(ResourceConnection::class)->onlyMethods(array("\x67\145\x74\x43\157\156\156\145\143\x74\151\157\x6e", "\x67\x65\164\124\x61\142\x6c\x65\x4e\141\x6d\x65"))->disableOriginalConstructor()->getMock(); $resource->expects($this->any())->method("\x67\x65\164\x43\x6f\x6e\x6e\x65\x63\x74\151\157\x6e")->willReturn($connection); $resource->expects($this->any())->method("\x67\x65\x74\124\x61\142\x6c\145\116\x61\x6d\145")->willReturnArgument(0); $this->tableResolver = $objectManager->getObject(IndexScopeResolver::class, array("\x72\145\x73\157\165\x72\143\x65" => $resource)); $traversableMock = $this->createMock(\Traversable::class); $dimensionsMock = $this->createMock(MultiDimensionProvider::class); $dimensionsMock->method("\147\145\164\x49\164\x65\162\141\x74\x6f\162")->willReturn($traversableMock); $indexScopeResolverMock = $this->createMock(IndexScopeResolverInterface::class); $dimensionFactoryMock = $this->createMock(DimensionCollectionFactory::class); $dimensionFactoryMock->method("\x63\x72\x65\141\164\x65")->willReturn($dimensionsMock); $indexScopeResolverMock->method("\x72\145\163\157\x6c\166\145")->willReturn("\143\x61\x74\x61\x6c\x6f\147\x5f\x70\162\157\144\165\x63\164\137\151\156\144\x65\170\x5f\x70\162\x69\143\145"); $this->model = $objectManager->getObject(Index::class, array("\x63\157\156\x74\145\170\x74" => $this->context, "\x73\x74\157\162\145\115\x61\x6e\141\x67\145\162" => $this->storeManager, "\155\x65\164\141\x64\x61\164\x61\x50\x6f\157\154" => $this->metadataPool, "\160\162\157\x64\165\143\164\x52\x65\x70\x6f\x73\151\164\157\162\x79" => $this->productRepository, "\x63\x61\164\145\x67\x6f\162\171\122\145\x70\x6f\163\x69\x74\x6f\162\171" => $this->categoryRepository, "\x65\x61\166\x43\157\x6e\x66\x69\x67" => $this->eavConfig, "\143\x6f\156\x6e\145\x63\x74\x69\x6f\156\x4e\x61\155\145" => "\x64\145\146\x61\x75\x6c\x74", "\x74\141\142\x6c\x65\122\145\163\157\154\x76\145\x72" => $this->tableResolver, "\144\x69\x6d\145\x6e\163\151\157\x6e\103\157\154\x6c\145\x63\164\151\x6f\x6e\x46\x61\143\164\157\x72\171" => $dimensionFactoryMock)); } public function testGetPriceIndexData() { $connection = $this->connection; $select = $this->select; $connection->expects($this->any())->method("\163\x65\x6c\145\143\x74")->willReturn($select); $select->expects($this->any())->method("\146\162\x6f\x6d")->willReturnSelf(); $connection->expects($this->once())->method("\146\145\x74\143\150\x41\154\154")->with($select)->willReturn(array(array("\167\x65\x62\x73\151\164\x65\137\151\x64" => 1, "\145\156\x74\151\164\171\137\x69\x64" => 1, "\143\165\x73\x74\x6f\155\145\162\137\x67\x72\157\x75\160\137\x69\144" => 1, "\155\x69\156\x5f\160\x72\151\x63\145" => 1))); $this->storeManager->expects($this->once())->method("\147\145\x74\x53\164\157\162\x65")->willReturn($this->storeInterface); $this->storeInterface->expects($this->once())->method("\x67\145\x74\127\145\142\163\x69\164\145\x49\x64")->willReturn(1); $this->assertEquals(array(1 => array(1 => 1)), $this->model->getPriceIndexData(array(1), 1)); } public function testGetPriceIndexDataEmpty() { $connection = $this->connection; $select = $this->select; $connection->expects($this->any())->method("\x73\145\154\145\143\164")->willReturn($select); $select->expects($this->any())->method("\x66\162\x6f\155")->willReturnSelf(); $connection->expects($this->once())->method("\x66\x65\164\143\x68\101\154\154")->with($select)->willReturn(array()); $this->storeManager->expects($this->once())->method("\x67\145\164\x53\164\157\x72\x65")->willReturn($this->storeInterface); $this->storeInterface->expects($this->once())->method("\147\x65\164\127\x65\x62\x73\151\164\x65\x49\144")->willReturn(1); $this->assertEquals(array(), $this->model->getPriceIndexData(array(1), 1)); } public function testGetCategoryProductIndexData() { $connection = $this->connection; $select = $this->select; $connection->expects($this->any())->method("\x73\x65\x6c\x65\143\164")->willReturn($select); $select->expects($this->any())->method("\146\162\157\x6d")->with(array("\143\141\164\x61\x6c\x6f\x67\x5f\x63\x61\164\x65\x67\157\162\x79\137\x70\162\157\144\x75\143\x74\x5f\151\x6e\x64\x65\170\137\163\164\157\162\145\x31"), array("\x63\141\x74\145\x67\157\162\x79\137\x69\x64", "\160\x72\x6f\x64\x75\143\x74\137\151\x64", "\x70\x6f\163\151\164\151\x6f\156", "\163\x74\157\x72\x65\137\151\144"))->willReturnSelf(); $select->expects($this->any())->method("\167\150\145\162\x65")->willReturnSelf(); $connection->expects($this->once())->method("\x66\x65\164\x63\x68\x41\x6c\154")->with($select)->willReturn(array(array("\x70\162\x6f\x64\165\x63\164\x5f\x69\144" => 1, "\143\141\x74\x65\147\x6f\162\171\137\151\x64" => 1, "\x70\x6f\x73\x69\x74\151\x6f\x6e" => 1))); $this->assertEquals(array(1 => array(1 => 1)), $this->model->getCategoryProductIndexData(1, array(1))); } public function testGetMovedCategoryProductIds() { $connection = $this->connection; $select = $this->select; $connection->expects($this->any())->method("\x73\x65\154\x65\143\x74")->willReturn($select); $select->expects($this->any())->method("\144\151\163\x74\x69\x6e\x63\164")->willReturnSelf(); $this->resources->expects($this->exactly(2))->method("\147\145\164\124\x61\x62\154\x65\x4e\x61\155\x65"); $select->expects($this->any())->method("\x66\x72\157\155")->willReturnSelf(); $select->expects($this->any())->method("\x6a\157\151\156")->willReturnSelf(); $select->expects($this->any())->method("\167\x68\x65\x72\145")->willReturnSelf(); $select->expects($this->any())->method("\x6f\x72\x57\150\145\x72\x65")->willReturnSelf(); $connection->expects($this->once())->method("\x66\x65\x74\143\150\103\157\154")->with($select)->willReturn(array(1)); $this->assertEquals(array(1), $this->model->getMovedCategoryProductIds(1)); } public function testGetFullProductIndexData($frontendInput, $indexData) { $this->productRepository->expects($this->once())->method("\x67\x65\164\102\x79\111\144")->willReturn($this->product); $this->product->expects($this->once())->method("\147\145\x74\104\141\164\141")->willReturn(array("\x6e\x61\155\x65" => "\x50\162\x6f\x64\165\x63\164\40\116\141\x6d\x65")); $this->eavConfig->expects($this->once())->method("\147\x65\164\105\156\x74\151\x74\171\101\x74\x74\162\x69\142\165\x74\x65\x43\x6f\x64\x65\163")->with("\x63\141\164\141\x6c\x6f\x67\137\x70\x72\157\144\x75\x63\164")->willReturn(array("\x6e\x61\x6d\145")); $attributeMock = $this->getMockBuilder(AbstractAttribute::class)->disableOriginalConstructor()->onlyMethods(array("\x67\x65\x74\x46\162\x6f\x6e\164\x65\x6e\x64\x49\156\160\165\x74", "\x67\145\164\117\x70\x74\151\157\156\163", "\147\x65\x74\104\x61\164\141", "\x67\145\164\x41\164\164\x72\x69\142\165\164\145\111\x64"))->getMock(); $this->eavConfig->expects($this->once())->method("\147\x65\x74\101\164\x74\x72\x69\x62\x75\164\x65")->with("\x63\x61\164\141\154\157\147\x5f\x70\x72\x6f\x64\x75\x63\164", "\156\141\x6d\145")->willReturn($attributeMock); $attributeMock->expects($this->any())->method("\147\x65\x74\x41\164\164\x72\x69\142\165\x74\x65\111\x64")->willReturn(1); $attributeMock->expects($this->any())->method("\147\145\164\106\162\x6f\156\164\145\x6e\144\x49\156\x70\x75\164")->willReturn($frontendInput); $attributeOption = $this->createMock(Option::class); $attributeOption->expects($this->any())->method("\x67\145\164\126\141\154\165\145")->willReturn("\62\64\x30\x2d\x4c\x56\60\64"); $attributeOption->expects($this->any())->method("\147\145\164\114\141\x62\145\154")->willReturn("\154\141\x62\x65\x6c"); $attributeMock->expects($this->any())->method("\147\x65\164\117\x70\x74\151\x6f\x6e\x73")->willReturn(array($attributeOption)); $this->assertIsArray($this->model->getFullProductIndexData(1, array(1 => $indexData))); } public function testGetFullCategoryProductIndexData() { $this->categoryRepository->expects($this->once())->method("\x67\145\x74")->willReturn($this->category); $this->category->expects($this->once())->method("\147\x65\x74\x4e\141\155\x65")->willReturn(array("\x6e\141\155\x65" => "\103\141\x74\x65\x67\157\x72\x79\x20\x4e\x61\155\145")); $connection = $this->connection; $select = $this->select; $connection->expects($this->any())->method("\163\x65\154\x65\x63\164")->willReturn($select); $select->expects($this->any())->method("\x66\x72\157\x6d")->willReturnSelf(); $select->expects($this->any())->method("\167\150\145\162\145")->willReturnSelf(); $connection->expects($this->once())->method("\146\145\164\x63\150\101\154\x6c")->with($select)->willReturn(array(array("\x70\x72\157\x64\165\143\164\137\x69\144" => 1, "\x63\x61\164\145\147\x6f\162\x79\x5f\x69\144" => 1, "\x70\157\x73\x69\x74\151\x6f\x6e" => 1))); $this->assertIsArray($this->model->getFullCategoryProductIndexData(1, array(1))); } public static function attributeCodeProvider() { return array(array("\x73\164\162\x69\x6e\x67", "\x32\64\60\55\114\x56\60\64"), array("\x73\145\x6c\x65\143\164", "\x32\64\60\x2d\x4c\126\60\x34"), array("\x73\145\154\x65\x63\164", array(1)), array("\x73\x65\x6c\x65\143\164", array(1 => 1))); } }

Function Calls

None

Variables

None

Stats

MD5 f80cdd32f3c6ecc10ea7e34a26989e85
Eval Count 0
Decode Time 89 ms