Skip to content

Commit 40482e1

Browse files
merge magento/2.3-develop into magento-tsg/2.3-develop-mftf-pr15
2 parents 2bdb1af + c7ac6df commit 40482e1

File tree

4 files changed

+159
-15
lines changed

4 files changed

+159
-15
lines changed

app/code/Magento/Backend/Block/Dashboard/Graph.php

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ public function __construct(
114114
\Magento\Backend\Helper\Dashboard\Data $dashboardData,
115115
array $data = []
116116
) {
117-
$this->_dashboardData = $dashboardData;
118117
parent::__construct($context, $collectionFactory, $data);
118+
$this->_dashboardData = $dashboardData;
119119
}
120120

121121
/**
@@ -131,7 +131,7 @@ protected function _getTabTemplate()
131131
/**
132132
* Set data rows
133133
*
134-
* @param array $rows
134+
* @param string $rows
135135
* @return void
136136
*/
137137
public function setDataRows($rows)
@@ -155,15 +155,14 @@ public function addSeries($seriesId, array $options)
155155
* Get series
156156
*
157157
* @param string $seriesId
158-
* @return array|false
158+
* @return array|bool
159159
*/
160160
public function getSeries($seriesId)
161161
{
162162
if (isset($this->_allSeries[$seriesId])) {
163163
return $this->_allSeries[$seriesId];
164-
} else {
165-
return false;
166164
}
165+
return false;
167166
}
168167

169168
/**
@@ -308,7 +307,7 @@ public function getChartUrl($directUrl = true)
308307

309308
if ($minvalue >= 0 && $maxvalue >= 0) {
310309
if ($maxvalue > 10) {
311-
$p = pow(10, $this->_getPow($maxvalue));
310+
$p = pow(10, $this->_getPow((int) $maxvalue));
312311
$maxy = ceil($maxvalue / $p) * $p;
313312
$yLabels = range($miny, $maxy, $p);
314313
} else {
@@ -349,7 +348,7 @@ public function getChartUrl($directUrl = true)
349348
$indexid = 0;
350349
foreach ($this->_axisLabels as $idx => $labels) {
351350
if ($idx == 'x') {
352-
$this->formatAxisLabelDate($idx, $timezoneLocal);
351+
$this->formatAxisLabelDate((string) $idx, (string) $timezoneLocal);
353352
$tmpstring = implode('|', $this->_axisLabels[$idx]);
354353
$valueBuffer[] = $indexid . ":|" . $tmpstring;
355354
} elseif ($idx == 'y') {
@@ -369,13 +368,12 @@ public function getChartUrl($directUrl = true)
369368
foreach ($params as $name => $value) {
370369
$p[] = $name . '=' . urlencode($value);
371370
}
372-
return self::API_URL . '?' . implode('&', $p);
373-
} else {
374-
$gaData = urlencode(base64_encode(json_encode($params)));
375-
$gaHash = $this->_dashboardData->getChartDataHash($gaData);
376-
$params = ['ga' => $gaData, 'h' => $gaHash];
377-
return $this->getUrl('adminhtml/*/tunnel', ['_query' => $params]);
371+
return (string) self::API_URL . '?' . implode('&', $p);
378372
}
373+
$gaData = urlencode(base64_encode(json_encode($params)));
374+
$gaHash = $this->_dashboardData->getChartDataHash($gaData);
375+
$params = ['ga' => $gaData, 'h' => $gaHash];
376+
return $this->getUrl('adminhtml/*/tunnel', ['_query' => $params]);
379377
}
380378

381379
/**
@@ -394,7 +392,7 @@ private function formatAxisLabelDate($idx, $timezoneLocal)
394392
switch ($this->getDataHelper()->getParam('period')) {
395393
case '24h':
396394
$this->_axisLabels[$idx][$_index] = $this->_localeDate->formatDateTime(
397-
$period->setTime($period->format('H'), 0, 0),
395+
$period->setTime((int) $period->format('H'), 0, 0),
398396
\IntlDateFormatter::NONE,
399397
\IntlDateFormatter::SHORT
400398
);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminDashboardSection">
12+
<element name="dashboardDiagramContent" type="button" selector="#diagram_tab_content"/>
13+
<element name="dashboardDiagramOrderContentTab" type="block" selector="#diagram_tab_orders_content"/>
14+
<element name="dashboardDiagramAmounts" type="button" selector="#diagram_tab_amounts"/>
15+
<element name="dashboardDiagramAmountsContentTab" type="block" selector="#diagram_tab_amounts_content"/>
16+
<element name="dashboardDiagramTotals" type="text" selector="#diagram_tab_amounts_content"/>
17+
<element name="dashboardTotals" type="text" selector="//*[@class='dashboard-totals-label' and contains(text(), '{{columnName}}')]/../*[@class='dashboard-totals-value']" parameterized="true"/>
18+
</section>
19+
</sections>
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminDashboardWithChartsTest">
12+
<annotations>
13+
<features value="Backend"/>
14+
<title value="Google chart on Magento dashboard"/>
15+
<description value="Google chart on Magento dashboard page is not broken"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MAGETWO-98934"/>
18+
<useCaseId value="MAGETWO-98584"/>
19+
<group value="backend"/>
20+
</annotations>
21+
<before>
22+
<magentoCLI command="config:set admin/dashboard/enable_charts 1" stepKey="setEnableCharts" />
23+
<createData entity="SimpleProduct2" stepKey="createProduct">
24+
<field key="price">150</field>
25+
</createData>
26+
<createData entity="Simple_US_Customer" stepKey="createCustomer">
27+
<field key="firstname">John1</field>
28+
<field key="lastname">Doe1</field>
29+
</createData>
30+
</before>
31+
<after>
32+
<!-- Reset admin order filter -->
33+
<comment userInput="Reset admin order filter" stepKey="resetAdminOrderFilter"/>
34+
<actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearOrderFilters"/>
35+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingOrderGrid"/>
36+
<magentoCLI command="config:set admin/dashboard/enable_charts 0" stepKey="setDisableChartsAsDefault" />
37+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
38+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
39+
<actionGroup ref="logout" stepKey="logout"/>
40+
</after>
41+
<!-- Login as admin -->
42+
<comment userInput="Login as admin" stepKey="adminLogin"/>
43+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
44+
<!-- Grab quantity value -->
45+
<comment userInput="Grab quantity value from dashboard" stepKey="grabQuantityFromDashboard"/>
46+
<grabTextFrom selector="{{AdminDashboardSection.dashboardTotals('Quantity')}}" stepKey="grabStartQuantity"/>
47+
<!-- Login as customer -->
48+
<comment userInput="Login as customer" stepKey="loginAsCustomer"/>
49+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin">
50+
<argument name="Customer" value="$$createCustomer$$" />
51+
</actionGroup>
52+
<!-- Add Product to Shopping Cart-->
53+
<comment userInput="Add product to the shopping cart" stepKey="addProductToCart"/>
54+
<amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToSimpleProductPage"/>
55+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
56+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage">
57+
<argument name="productName" value="$$createProduct.name$$"/>
58+
</actionGroup>
59+
<!--Go to Checkout-->
60+
<comment userInput="Go to checkout" stepKey="goToCheckout"/>
61+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
62+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingCheckoutPageWithShippingMethod"/>
63+
<click selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
64+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask1"/>
65+
<waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/>
66+
<click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext"/>
67+
<!-- Checkout select Check/Money Order payment -->
68+
<comment userInput="Select Check/Money payment" stepKey="checkoutSelectCheckMoneyPayment"/>
69+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/>
70+
<!-- Place Order -->
71+
<comment userInput="Place order" stepKey="placeOrder"/>
72+
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
73+
<see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="seeSuccessTitle"/>
74+
<see selector="{{CheckoutSuccessMainSection.orderNumberText}}" userInput="Your order number is: " stepKey="seeOrderNumber"/>
75+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>
76+
<!-- Search for Order in the order grid -->
77+
<comment userInput="Search for Order in the order grid" stepKey="searchOrderInGrid"/>
78+
<actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById">
79+
<argument name="orderId" value="$grabOrderNumber"/>
80+
</actionGroup>
81+
<waitForLoadingMaskToDisappear stepKey="waitForSearchingOrder"/>
82+
<!-- Create invoice -->
83+
<comment userInput="Create invoice" stepKey="createInvoice"/>
84+
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
85+
<click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceButton"/>
86+
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seeNewInvoiceInPageTitle" after="clickInvoiceButton"/>
87+
<see selector="{{AdminInvoiceTotalSection.total('Subtotal')}}" userInput="$150.00" stepKey="seeCorrectGrandTotal"/>
88+
<click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/>
89+
<see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeSuccessInvoiceMessage"/>
90+
<!--Create Shipment for the order-->
91+
<comment userInput="Create Shipment for the order" stepKey="createShipmentForOrder"/>
92+
<amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage2"/>
93+
<waitForPageLoad time="30" stepKey="waitForOrderListPageLoading"/>
94+
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="openOrderPageForShip"/>
95+
<waitForPageLoad stepKey="waitForOrderDetailsPage"/>
96+
<click selector="{{AdminOrderDetailsMainActionsSection.ship}}" stepKey="clickShipAction"/>
97+
<waitForPageLoad stepKey="waitForShipmentPagePage"/>
98+
<seeInCurrentUrl url="{{AdminShipmentNewPage.url}}" stepKey="seeOrderShipmentUrl"/>
99+
<!--Submit Shipment-->
100+
<comment userInput="Submit Shipment" stepKey="submitShipment"/>
101+
<click selector="{{AdminShipmentMainActionsSection.submitShipment}}" stepKey="clickSubmitShipment"/>
102+
<waitForPageLoad stepKey="waitForShipmentSubmit"/>
103+
<see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The shipment has been created." stepKey="seeShipmentCreateSuccess"/>
104+
<!-- Go to dashboard page -->
105+
<comment userInput="Go to dashboard page" stepKey="goToDashboardPage"/>
106+
<amOnPage url="{{AdminDashboardPage.url}}" stepKey="amOnDashboardPage"/>
107+
<waitForPageLoad stepKey="waitForDashboardPageLoad4"/>
108+
<!-- Grab quantity value -->
109+
<comment userInput="Grab quantity value from dashboard at the end" stepKey="grabQuantityFromDashboardAtTheEnd"/>
110+
<grabTextFrom selector="{{AdminDashboardSection.dashboardTotals('Quantity')}}" stepKey="grabEndQuantity"/>
111+
<!-- Assert that page is not broken -->
112+
<comment userInput="Assert that dashboard page is not broken" stepKey="assertDashboardPageIsNotBroken"/>
113+
<seeElement selector="{{AdminDashboardSection.dashboardDiagramOrderContentTab}}" stepKey="seeOrderContentTab"/>
114+
<seeElement selector="{{AdminDashboardSection.dashboardDiagramContent}}" stepKey="seeDiagramContent"/>
115+
<click selector="{{AdminDashboardSection.dashboardDiagramAmounts}}" stepKey="clickDashboardAmount"/>
116+
<waitForLoadingMaskToDisappear stepKey="waitForDashboardAmountLoading"/>
117+
<seeElement selector="{{AdminDashboardSection.dashboardDiagramAmountsContentTab}}" stepKey="seeDiagramAmountContent"/>
118+
<seeElement selector="{{AdminDashboardSection.dashboardDiagramTotals}}" stepKey="seeAmountTotals"/>
119+
<dontSeeJsError stepKey="dontSeeJsError"/>
120+
<assertGreaterThan expected="$grabStartQuantity" actual="$grabEndQuantity" stepKey="checkQuantityWasChanged"/>
121+
</test>
122+
</tests>

dev/tests/integration/testsuite/Magento/Ups/Model/CarrierTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Ups\Model;
79

810
use Magento\TestFramework\Helper\Bootstrap;
911
use Magento\Quote\Model\Quote\Address\RateRequestFactory;
1012

13+
/**
14+
* Integration tests for Carrier model class
15+
*/
1116
class CarrierTest extends \PHPUnit\Framework\TestCase
1217
{
1318
/**
@@ -64,12 +69,12 @@ public function testGetShipConfirmUrlLive()
6469

6570
/**
6671
* @magentoConfigFixture current_store carriers/ups/active 1
72+
* @magentoConfigFixture current_store carriers/ups/type UPS
6773
* @magentoConfigFixture current_store carriers/ups/allowed_methods 1DA,GND
6874
* @magentoConfigFixture current_store carriers/ups/free_method GND
6975
*/
7076
public function testCollectFreeRates()
7177
{
72-
$this->markTestSkipped('Test is blocked by MAGETWO-97467.');
7378
$rateRequest = Bootstrap::getObjectManager()->get(RateRequestFactory::class)->create();
7479
$rateRequest->setDestCountryId('US');
7580
$rateRequest->setDestRegionId('CA');

0 commit comments

Comments
 (0)