DataObject PHP Class Code Examples

This page contains top rated real world PHP examples of class DataObject extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: AuthorizationPolicyTest.php Project: mczirfusz/pkp-lib
0
 /**
  * @covers AuthorizationPolicy
  */
 public function testAuthorizationPolicy()
 {
     $policy = new AuthorizationPolicy('some message');
     // Test advice.
     self::assertTrue($policy->hasAdvice(AUTHORIZATION_ADVICE_DENY_MESSAGE));
     self::assertFalse($policy->hasAdvice(AUTHORIZATION_ADVICE_CALL_ON_DENY));
     self::assertEquals('some message', $policy->getAdvice(AUTHORIZATION_ADVICE_DENY_MESSAGE));
     self::assertNull($policy->getAdvice(AUTHORIZATION_ADVICE_CALL_ON_DENY));
     // Test authorized context objects.
     self::assertFalse($policy->hasAuthorizedContextObject(ASSOC_TYPE_USER_GROUP));
     $someContextObject = new DataObject();
     $someContextObject->setData('test1', 'test1');
     $policy->addAuthorizedContextObject(ASSOC_TYPE_USER_GROUP, $someContextObject);
     self::assertTrue($policy->hasAuthorizedContextObject(ASSOC_TYPE_USER_GROUP));
     self::assertEquals($someContextObject, $policy->getAuthorizedContextObject(ASSOC_TYPE_USER_GROUP));
     self::assertEquals(array(ASSOC_TYPE_USER_GROUP => $someContextObject), $policy->getAuthorizedContext());
     // Test authorized context.
     $someOtherContextObject = new DataObject();
     $someOtherContextObject->setData('test2', 'test2');
     $authorizedContext = array(ASSOC_TYPE_USER_GROUP => $someOtherContextObject);
     $policy->setAuthorizedContext($authorizedContext);
     self::assertEquals($authorizedContext, $policy->getAuthorizedContext());
     // Test default policies.
     self::assertTrue($policy->applies());
     self::assertEquals(AUTHORIZATION_DENY, $policy->effect());
 }
Example #2
Show file File: ConfigTest.php Project: pradeep-wagento/magento2
0
 /**
  * Data provider for testCreateConfigForInvalidXml
  *
  * @return array
  */
 public function getValidationRulesDataProvider()
 {
     $result = [];
     // Case 1. Pass check alnum and int properties are not empty and have valid value
     $entityName = 'test_entity_a';
     $groupName = 'check_alnum_and_int_not_empty_and_have_valid_value';
     $value = new \Magento\Framework\DataObject(['int' => 1, 'alnum' => 'abc123']);
     $expectedResult = true;
     $expectedMessages = [];
     $result[] = [$entityName, $groupName, $value, $expectedResult, $expectedMessages];
     // Case 2. Fail check alnum is not empty
     $value = new \Magento\Framework\DataObject(['int' => 'abc123', 'alnum' => null]);
     $expectedResult = false;
     $expectedMessages = ['alnum' => ['isEmpty' => 'Value is required and can\'t be empty', 'alnumInvalid' => 'Invalid type given. String, integer or float expected'], 'int' => ['notInt' => '\'abc123\' does not appear to be an integer']];
     $result[] = [$entityName, $groupName, $value, $expectedResult, $expectedMessages];
     // Case 3. Pass check alnum has valid value
     $groupName = 'check_alnum';
     $value = new \Magento\Framework\DataObject(['int' => 'abc123', 'alnum' => 'abc123']);
     $expectedResult = true;
     $expectedMessages = [];
     $result[] = [$entityName, $groupName, $value, $expectedResult, $expectedMessages];
     // Case 4. Fail check alnum has valid value
     $value = new \Magento\Framework\DataObject(['int' => 'abc123', 'alnum' => '[abc123]']);
     $expectedResult = false;
     $expectedMessages = ['alnum' => ['notAlnum' => '\'[abc123]\' contains characters which are non alphabetic and no digits']];
     $result[] = [$entityName, $groupName, $value, $expectedResult, $expectedMessages];
     return $result;
 }
Example #3
Show file File: AbcPaginator.php Project: helpfulrobot/azt3k-abc-silverstripe
0
 public function dataForTemplate($totalHits = null, $pageDisplayRange = null, $baseURL = null, $hitsSelectorOptions = null)
 {
     // check if we have total hits
     if ($totalHits === null) {
         $totalHits = $this->unlimitedRowCount;
     }
     // pageDisplayRange
     if ($pageDisplayRange === null) {
         $pageDisplayRange = self::$defaultPageDisplayRange;
     }
     // init vars
     $this->totalPages = $totalPages = ceil($totalHits / $this->limit);
     $pageLinks = new DataObject();
     $return = new DataObject();
     // init vars
     $pageLinks->FirstPage = $pageLinks->LastPage = $pageLinks->PreviousPage = $pageLinks->NextPage = null;
     $pageLinks->Total = $totalPages;
     // Prep page links
     if ($this->currentPage > 1 + $pageDisplayRange) {
         $pageLinks->FirstPage = AbcURL::get($baseURL)->q(array('hits' => $this->limit, 'page' => 1))->URL;
     }
     if ($this->currentPage < $totalPages - $pageDisplayRange) {
         $pageLinks->LastPage = AbcURL::get($baseURL)->q(array('hits' => $this->limit, 'page' => $totalPages))->URL;
     }
     if ($this->currentPage != 1) {
         $pageLinks->PreviousPage = AbcURL::get($baseURL)->q(array('hits' => $this->limit, 'page' => $this->currentPage - 1))->URL;
     }
     if ($this->currentPage != $totalPages) {
         $pageLinks->NextPage = AbcURL::get($baseURL)->q(array('hits' => $this->limit, 'page' => $this->currentPage + 1))->URL;
     }
     // page quick links
     $pageLinks->QuickLinks = new ArrayList();
     // Define the range
     $maxShow = $this->currentPage + $pageDisplayRange;
     $minShow = $this->currentPage - $pageDisplayRange;
     if ($maxShow > $totalPages) {
         $maxShow = $totalPages;
     }
     if ($minShow < 1) {
         $minShow = 1;
     }
     // make links
     for ($i = $minShow; $i <= $maxShow; $i++) {
         $link = new DataObject();
         $link->PageLink = $i == $this->currentPage ? null : AbcURL::get($baseURL)->q(array('hits' => $this->limit, 'page' => $i))->URL;
         $link->PageNum = $i;
         $pageLinks->QuickLinks->push($link);
     }
     // die($totalHits .' vs '. $this->limit);
     // Prep return data
     $return->HitsSelector = $this->HitsSelector($baseURL, $hitsSelectorOptions);
     $return->TotalHits = strval($totalHits);
     $return->TotalPages = strval($totalPages);
     $return->CurrentPageNum = strval($this->currentPage);
     $return->HitsPerPage = strval($this->limit);
     $return->PaginatorRequired = $totalHits <= $this->limit ? false : true;
     $return->PageLinks = $pageLinks;
     $return->PageLinks->Paginator = $this;
     return $return;
 }
Example #4
Show file File: PayPalTest.php Project: pradeep-wagento/magento2
0
 /**
  * @param \Magento\Framework\DataObject $paymentObject
  * @param int $storeId
  * @return array
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function setupPaymentObject(\Magento\Framework\DataObject $paymentObject, $storeId)
 {
     $customerId = '12';
     $customerEmail = 'abc@example.com';
     $company = 'NA';
     $phone = '3316655';
     $fax = '3316677';
     $orderId = '100000024';
     $street = '1201 N 1st Stree';
     $street2 = 'build 45';
     $city = 'San Jose';
     $region = 'California';
     $regionCode = 'CA';
     $regionId = 65;
     $postcode = '63241';
     $countryId = 'US';
     $addressData = ['firstname' => self::FNAME, 'lastname' => self::LNAME, 'company' => $company, 'telephone' => $phone, 'fax' => $fax, 'street' => [$street, $street2], 'city' => $city, 'region' => $region, 'region_id' => $regionId, 'postcode' => $postcode, 'country_id' => $countryId, 'address_type' => 'billing'];
     $billingAddress = new \Magento\Framework\DataObject($addressData);
     $addressData['address_type'] = 'shipping';
     $shippingAddress = new \Magento\Framework\DataObject($addressData);
     $order = $this->setupOrderMock($billingAddress, $shippingAddress, $customerEmail, $orderId, $customerId, $storeId);
     $paymentObject->setOrder($order);
     $this->helperMock->expects($this->once())->method('generateCustomerId')->with($customerId, $customerEmail)->willReturn(self::CUSTOMER_ID);
     $regionMock = $this->getMockBuilder('Magento\\Directory\\Model\\Region')->disableOriginalConstructor()->setMethods(['getId', 'getCode', 'load'])->getMock();
     $regionMock->expects($this->any())->method('getId')->willReturn($regionId);
     $regionMock->expects($this->any())->method('getCode')->willReturn($regionCode);
     $regionMock->expects($this->any())->method('load')->with($regionId)->willReturnSelf();
     $this->regionFactoryMock->expects($this->any())->method('create')->willReturn($regionMock);
     $braintreeAddressData = ['firstName' => self::FNAME, 'lastName' => self::LNAME, 'company' => $company, 'streetAddress' => $street, 'extendedAddress' => $street2, 'locality' => $city, 'region' => $regionCode, 'postalCode' => $postcode, 'countryCodeAlpha2' => $countryId];
     return ['channel' => self::CHANNEL, 'orderId' => $orderId, 'customer' => ['firstName' => self::FNAME, 'lastName' => self::LNAME, 'company' => $company, 'phone' => $phone, 'fax' => $fax, 'email' => $customerEmail], 'billing' => $braintreeAddressData, 'shipping' => $braintreeAddressData];
 }
Example #5
Show file File: AbstractProductTest.php Project: kidaa30/magento2-platformsh
0
 public function testValidateSetEntityAttributeValuesWithoutResource()
 {
     $product = $this->getMock('Magento\\Framework\\Model\\AbstractModel', ['someMethod', 'getResource', 'load'], [], '', false);
     $this->_condition->setAttribute('someAttribute');
     $product->setAtribute('attribute');
     $product->setId(12);
     $this->_configProperty->setValue($this->_condition, $this->getMock('Magento\\Eav\\Model\\Config', [], [], '', false));
     $this->_entityAttributeValuesProperty->setValue($this->_condition, $this->getMock('Magento\\Eav\\Model\\Config', [], [], '', false));
     $attribute = new \Magento\Framework\DataObject();
     $attribute->setBackendType('multiselect');
     $newResource = $this->getMock('\\Magento\\Catalog\\Model\\ResourceModel\\Product', ['getAttribute'], [], '', false);
     $newResource->expects($this->any())->method('getAttribute')->with('someAttribute')->will($this->returnValue($attribute));
     $newResource->_config = $this->getMock('Magento\\Eav\\Model\\Config', [], [], '', false);
     $product->expects($this->atLeastOnce())->method('getResource')->willReturn($newResource);
     $this->_entityAttributeValuesProperty->setValue($this->_condition, [1 => [''], 2 => ['option1,option2,option3'], 3 => ['option1,option2,option3']]);
     $this->assertFalse($this->_condition->validate($product));
     $attribute = new \Magento\Framework\DataObject();
     $attribute->setBackendType(null);
     $attribute->setFrontendInput('multiselect');
     $newResource = $this->getMock('\\Magento\\Catalog\\Model\\ResourceModel\\Product', ['getAttribute'], [], '', false);
     $newResource->expects($this->any())->method('getAttribute')->with('someAttribute')->will($this->returnValue($attribute));
     $newResource->_config = $this->getMock('Magento\\Eav\\Model\\Config', [], [], '', false);
     $product->setResource($newResource);
     $product->setId(1);
     $product->setData('someAttribute', 'value');
     $this->assertFalse($this->_condition->validate($product));
 }
Example #6
Show file File: Compiler.php Project: kidaa30/magento2-platformsh
0
 /**
  * The compilation of the template and filling in the data
  *
  * @param \DOMNode $node
  * @param DataObject $processedObject
  * @param DataObject $context
  * @return void
  */
 public function compile(\DOMNode $node, DataObject $processedObject, DataObject $context)
 {
     switch ($node->nodeType) {
         case XML_TEXT_NODE:
             $this->compilerText->compile($node, $processedObject);
             break;
         case XML_CDATA_SECTION_NODE:
             $this->compilerCdata->compile($node, $processedObject);
             break;
         case XML_COMMENT_NODE:
             $this->compilerComment->compile($node, $processedObject);
             break;
         default:
             /** @var \DomElement $node */
             if ($node->hasAttributes()) {
                 foreach ($node->attributes as $attribute) {
                     $this->compilerAttribute->compile($attribute, $processedObject);
                 }
             }
             $compiler = $this->getElementCompiler($node->nodeName);
             if (null !== $compiler) {
                 $compiler->compile($this, $node, $processedObject, $context);
             } else {
                 if ($node->hasChildNodes()) {
                     foreach ($this->getChildNodes($node) as $child) {
                         $this->compile($child, $processedObject, $context);
                     }
                 }
             }
     }
 }
Example #7
Show file File: Totals.php Project: pradeep-wagento/magento2
0
 /**
  * Initialize order totals array
  *
  * @return $this
  */
 protected function _initTotals()
 {
     parent::_initTotals();
     $this->removeTotal('base_grandtotal');
     if ((double) $this->getSource()->getAdjustmentPositive()) {
         $total = new \Magento\Framework\DataObject(['code' => 'adjustment_positive', 'value' => $this->getSource()->getAdjustmentPositive(), 'label' => __('Adjustment Refund')]);
         $this->addTotal($total);
     }
     if ((double) $this->getSource()->getAdjustmentNegative()) {
         $total = new \Magento\Framework\DataObject(['code' => 'adjustment_negative', 'value' => $this->getSource()->getAdjustmentNegative(), 'label' => __('Adjustment Fee')]);
         $this->addTotal($total);
     }
     /**
             <?php if ($this->getCanDisplayTotalPaid()): ?>
             <tr>
        <td colspan="6" class="a-right"><strong><?php echo __('Total Paid') ?></strong></td>
        <td class="last a-right"><strong><?php echo $_order->formatPrice($_creditmemo->getTotalPaid()) ?></strong></td>
             </tr>
             <?php endif; ?>
             <?php if ($this->getCanDisplayTotalRefunded()): ?>
             <tr>
        <td colspan="6" class="a-right"><strong><?php echo __('Total Refunded') ?></strong></td>
        <td class="last a-right"><strong><?php echo $_order->formatPrice($_creditmemo->getTotalRefunded()) ?></strong></td>
             </tr>
             <?php endif; ?>
             <?php if ($this->getCanDisplayTotalDue()): ?>
             <tr>
        <td colspan="6" class="a-right"><strong><?php echo __('Total Due') ?></strong></td>
        <td class="last a-right"><strong><?php echo $_order->formatPrice($_creditmemo->getTotalDue()) ?></strong></td>
             </tr>
             <?php endif; ?>
     */
     return $this;
 }
Example #8
Show file File: ContainerTest.php Project: kidaa30/magento2-platformsh
0
 public function testSetDataObject()
 {
     $form = new \Magento\Framework\DataObject();
     $dataObject = new \Magento\Framework\DataObject();
     // _prepateLayout() is blocked, because it is used by block to instantly add 'form' child
     $block = $this->getMock('Magento\\Backend\\Block\\Widget\\Form\\Container', ['getChildBlock'], [], '', false);
     $block->expects($this->once())->method('getChildBlock')->with('form')->will($this->returnValue($form));
     $block->setDataObject($dataObject);
     $this->assertSame($dataObject, $block->getDataObject());
     $this->assertSame($dataObject, $form->getDataObject());
 }
Example #9
Show file File: PayflowlinkTest.php Project: pradeep-wagento/magento2
0
 public function testInitialize()
 {
     $order = $this->getMock('Magento\\Sales\\Model\\Order', [], [], '', false);
     $this->infoInstance->expects($this->any())->method('getOrder')->will($this->returnValue($order));
     $this->infoInstance->expects($this->any())->method('setAdditionalInformation')->will($this->returnSelf());
     $this->paypalConfig->expects($this->once())->method('getBuildNotationCode')->will($this->returnValue('build notation code'));
     $response = new \Magento\Framework\DataObject(['result' => '0', 'pnref' => 'V19A3D27B61E', 'respmsg' => 'Approved', 'authcode' => '510PNI', 'hostcode' => 'A', 'request_id' => 'f930d3dc6824c1f7230c5529dc37ae5e', 'result_code' => '0']);
     $this->gatewayMock->expects($this->once())->method('postRequest')->willReturn($response);
     $this->payflowRequest->expects($this->exactly(3))->method('setData')->willReturnMap([['user' => null, 'vendor' => null, 'partner' => null, 'pwd' => null, 'verbosity' => null, 'BNCODE' => 'build notation code', 'tender' => 'C'], $this->returnSelf()], ['USER1', 1, $this->returnSelf()], ['USER2', 'a20d3dc6824c1f7780c5529dc37ae5e', $this->returnSelf()]);
     $stateObject = new \Magento\Framework\DataObject();
     $this->model->initialize(\Magento\Paypal\Model\Config::PAYMENT_ACTION_AUTH, $stateObject);
 }
Example #10
Show file File: WeeeTest.php Project: pradeep-wagento/magento2
0
 /**
  * Setup calculator to return tax rates
  *
  * @param array $taxRates
  * @return \PHPUnit_Framework_MockObject_MockObject|\Magento\Tax\Model\Calculation
  */
 protected function setupTaxCalculation($taxRates)
 {
     $storeTaxRate = $taxRates['store_tax_rate'];
     $customerTaxRate = $taxRates['customer_tax_rate'];
     $taxCalculation = $this->getMock('Magento\\Tax\\Model\\Calculation', [], [], '', false);
     $rateRequest = new \Magento\Framework\DataObject();
     $defaultRateRequest = new \Magento\Framework\DataObject();
     $taxCalculation->expects($this->any())->method('getRateRequest')->will($this->returnValue($rateRequest));
     $taxCalculation->expects($this->any())->method('getRateOriginRequest')->will($this->returnValue($defaultRateRequest));
     $taxCalculation->expects($this->any())->method('getRate')->will($this->onConsecutiveCalls($storeTaxRate, $customerTaxRate));
     return $taxCalculation;
 }
Example #11
Show file File: Wishlist.php Project: pradeep-wagento/magento2
0
 /**
  * Update wishlist Item and set data from request
  *
  * The $params sets how current item configuration must be taken into account and additional options.
  * It's passed to \Magento\Catalog\Helper\Product->addParamsToBuyRequest() to compose resulting buyRequest.
  *
  * Basically it can hold
  * - 'current_config', \Magento\Framework\DataObject or array - current buyRequest
  *   that configures product in this item, used to restore currently attached files
  * - 'files_prefix': string[a-z0-9_] - prefix that was added at frontend to names of file options (file inputs),
  * so they won't intersect with other submitted options
  *
  * For more options see \Magento\Catalog\Helper\Product->addParamsToBuyRequest()
  *
  * @param int|Item $itemId
  * @param \Magento\Framework\DataObject $buyRequest
  * @param null|array|\Magento\Framework\DataObject $params
  * @return $this
  * @throws \Magento\Framework\Exception\LocalizedException
  *
  * @see \Magento\Catalog\Helper\Product::addParamsToBuyRequest()
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function updateItem($itemId, $buyRequest, $params = null)
 {
     $item = null;
     if ($itemId instanceof Item) {
         $item = $itemId;
     } else {
         $item = $this->getItem((int) $itemId);
     }
     if (!$item) {
         throw new \Magento\Framework\Exception\LocalizedException(__('We can\'t specify a wish list item.'));
     }
     $product = $item->getProduct();
     $productId = $product->getId();
     if ($productId) {
         if (!$params) {
             $params = new \Magento\Framework\DataObject();
         } elseif (is_array($params)) {
             $params = new \Magento\Framework\DataObject($params);
         }
         $params->setCurrentConfig($item->getBuyRequest());
         $buyRequest = $this->_catalogProduct->addParamsToBuyRequest($buyRequest, $params);
         $product->setWishlistStoreId($item->getStoreId());
         $items = $this->getItemCollection();
         $isForceSetQuantity = true;
         foreach ($items as $_item) {
             /* @var $_item Item */
             if ($_item->getProductId() == $product->getId() && $_item->representProduct($product) && $_item->getId() != $item->getId()) {
                 // We do not add new wishlist item, but updating the existing one
                 $isForceSetQuantity = false;
             }
         }
         $resultItem = $this->addNewItem($product, $buyRequest, $isForceSetQuantity);
         /**
          * Error message
          */
         if (is_string($resultItem)) {
             throw new \Magento\Framework\Exception\LocalizedException(__($resultItem));
         }
         if ($resultItem->getId() != $itemId) {
             if ($resultItem->getDescription() != $item->getDescription()) {
                 $resultItem->setDescription($item->getDescription())->save();
             }
             $item->isDeleted(true);
             $this->setDataChanges(true);
         } else {
             $resultItem->setQty($buyRequest->getQty() * 1);
             $resultItem->setOrigData('qty', 0);
         }
     } else {
         throw new \Magento\Framework\Exception\LocalizedException(__('The product does not exist.'));
     }
     return $this;
 }
Example #12
Show file File: ManagerTest.php Project: pradeep-wagento/magento2
0
 /**
  * @return void
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function testAfterProcessIntegrationConfigSuccess()
 {
     $testIntegration1Resource = ['Magento_Customer::manage', 'Magento_Customer::online', 'Magento_Sales::create', 'Magento_SalesRule::quote'];
     $testIntegration2Resource = ['Magento_Catalog::product_read'];
     $this->integrationConfigMock->expects($this->once())->method('getIntegrations')->will($this->returnValue(['TestIntegration1' => ['resources' => $testIntegration1Resource], 'TestIntegration2' => ['resources' => $testIntegration2Resource]]));
     $firstInegrationId = 1;
     $integrationsData1 = new \Magento\Framework\DataObject(['id' => $firstInegrationId, Integration::NAME => 'TestIntegration1', Integration::EMAIL => 'test-integration1@magento.com', Integration::ENDPOINT => 'http://endpoint.com', Integration::SETUP_TYPE => 1]);
     $secondIntegrationId = 2;
     $integrationsData2 = new \Magento\Framework\DataObject(['id' => $secondIntegrationId, Integration::NAME => 'TestIntegration2', Integration::EMAIL => 'test-integration2@magento.com', Integration::SETUP_TYPE => 1]);
     $this->integrationServiceMock->expects($this->at(0))->method('findByName')->with('TestIntegration1')->will($this->returnValue($integrationsData1));
     $this->integrationServiceMock->expects($this->at(1))->method('findByName')->with('TestIntegration2')->will($this->returnValue($integrationsData2));
     $this->apiSetupPlugin->afterProcessIntegrationConfig($this->subjectMock, ['TestIntegration1', 'TestIntegration2']);
 }
Example #13
Show file File: ScheduledTest.php Project: pradeep-wagento/magento2
0
 /**
  * @param bool $rowValue
  * @param string $class
  * @param string $text
  * @dataProvider typeProvider
  */
 public function testRender($rowValue, $class, $text)
 {
     $html = '<span class="' . $class . '"><span>' . $text . '</span></span>';
     $row = new \Magento\Framework\DataObject();
     $column = new \Magento\Framework\DataObject();
     $context = $this->getMockBuilder('\\Magento\\Backend\\Block\\Context')->disableOriginalConstructor()->getMock();
     $model = new \Magento\Indexer\Block\Backend\Grid\Column\Renderer\Scheduled($context);
     $column->setGetter('getValue');
     $row->setValue($rowValue);
     $model->setColumn($column);
     $result = $model->render($row);
     $this->assertEquals($result, $html);
 }
Example #14
Show file File: CompositeTest.php Project: pradeep-wagento/magento2
0
 public function testFilterAndSortDeclaredComponents()
 {
     $firstComponent = new \Magento\Framework\DataObject();
     $secondComponent = new \Magento\Framework\DataObject();
     $thirdComponent = new \Magento\Framework\DataObject();
     $contexts = [['type' => new \Magento\Framework\DataObject()], ['sortOrder' => 50], ['sortOrder' => 20, 'type' => $firstComponent], ['sortOrder' => 30, 'type' => $secondComponent], ['sortOrder' => 10, 'type' => $thirdComponent]];
     $result = $this->compositeHelper->filterAndSortDeclaredComponents($contexts);
     /** Ensure that misconfigured components were filtered out correctly */
     $this->assertCount(3, $result, 'Misconfigured components filtration does not work as expected.');
     /** Verify that components were ordered according to the defined sort order */
     $incorrectSortingMessage = "Registered components were sorted incorrectly";
     $this->assertSame($thirdComponent, $result[0]['type'], $incorrectSortingMessage);
     $this->assertSame($firstComponent, $result[1]['type'], $incorrectSortingMessage);
     $this->assertSame($secondComponent, $result[2]['type'], $incorrectSortingMessage);
 }
Example #15
Show file File: IncludeElement.php Project: pradeep-wagento/magento2
0
 /**
  * Compiles the Element node
  *
  * @param CompilerInterface $compiler
  * @param \DOMElement $node
  * @param DataObject $processedObject
  * @param DataObject $context
  * @return void
  */
 public function compile(CompilerInterface $compiler, \DOMElement $node, DataObject $processedObject, DataObject $context)
 {
     $ownerDocument = $node->ownerDocument;
     $parentNode = $node->parentNode;
     $document = new \DOMDocument();
     $document->loadXML($this->getContent($node->getAttribute(static::INCLUDE_PATH)));
     foreach ($this->getChildNodes($document->documentElement) as $child) {
         $compiler->compile($child, $processedObject, $context);
     }
     $newFragment = $ownerDocument->createDocumentFragment();
     foreach ($document->documentElement->childNodes as $child) {
         $newFragment->appendXML($document->saveXML($child));
     }
     $parentNode->replaceChild($newFragment, $node);
 }