File tree Expand file tree Collapse file tree 5 files changed +65
-63
lines changed
DataProviders/Email/Shipment
dev/tests/integration/testsuite/Magento/Shipping/Controller/Adminhtml/Order/Shipment Expand file tree Collapse file tree 5 files changed +65
-63
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ declare (strict_types=1 );
7
+
8
+ namespace Magento \Sales \Block \DataProviders \Email \Shipment ;
9
+
10
+ use Magento \Framework \View \Element \Block \ArgumentInterface ;
11
+ use Magento \Sales \Model \Order \Shipment \Track ;
12
+ use Magento \Shipping \Helper \Data as ShippingHelper ;
13
+
14
+ /**
15
+ * Shipment track info for email
16
+ */
17
+ class TrackingUrl implements ArgumentInterface
18
+ {
19
+ /**
20
+ * @var ShippingHelper
21
+ */
22
+ private $ helper ;
23
+
24
+ /**
25
+ * @param ShippingHelper $helper
26
+ */
27
+ public function __construct (ShippingHelper $ helper )
28
+ {
29
+ $ this ->helper = $ helper ;
30
+ }
31
+
32
+ /**
33
+ * Get Shipping tracking URL
34
+ *
35
+ * @param Track $track
36
+ * @return string
37
+ */
38
+ public function getUrl (Track $ track ): string
39
+ {
40
+ return $ this ->helper ->getTrackingPopupUrlBySalesModel ($ track );
41
+ }
42
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 8
8
<page xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:framework:View/Layout/etc/page_configuration.xsd" >
9
9
<update handle =" sales_email_order_shipment_renderers" />
10
10
<body >
11
- <block class =" Magento\Sales\Block\Email\Shipment\Track" name =" sales.order.email.shipment.track" template =" Magento_Sales::email/shipment/track.phtml" />
11
+ <block class =" Magento\Framework\View\Element\Template" name =" sales.order.email.shipment.track" template =" Magento_Sales::email/shipment/track.phtml" >
12
+ <arguments >
13
+ <argument name =" tracking_url" xsi : type =" object" >Magento\Sales\Block\DataProviders\Email\Shipment\TrackingUrl</argument >
14
+ </arguments >
15
+ </block >
12
16
</body >
13
17
</page >
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ $_order = $block->getOrder() ?>
25
25
<tr>
26
26
<td><?= $ block ->escapeHtml ($ _item ->getTitle ()) ?> :</td>
27
27
<td>
28
- <a href="<?= $ block ->getTrackingUrlEscaped ( $ _item ) ?> " target="_blank">
28
+ <a href="<?= $ block ->escapeUrl ( $ block -> getTrackingUrl ()-> getUrl ( $ _item) ) ?> " target="_blank">
29
29
<?= $ block ->escapeHtml ($ _item ->getNumber ()) ?>
30
30
</a>
31
31
</td>
Original file line number Diff line number Diff line change @@ -28,7 +28,14 @@ class SaveTest extends AbstractShipmentControllerTest
28
28
*/
29
29
public function testSendEmailOnShipmentSave (): void
30
30
{
31
- $ order = $ this ->prepareRequest (['shipment ' => ['send_email ' => true ]]);
31
+ $ tracking = [
32
+ [
33
+ 'number ' => 'some_racking_number ' ,
34
+ 'title ' => 'some_tracking_title ' ,
35
+ 'carrier_code ' => 'carrier_code '
36
+ ]
37
+ ];
38
+ $ order = $ this ->prepareRequest (['shipment ' => ['send_email ' => true ], 'tracking ' => $ tracking ]);
32
39
$ this ->dispatch ('backend/admin/order_shipment/save ' );
33
40
34
41
$ this ->assertSessionMessages (
@@ -47,6 +54,15 @@ public function testSendEmailOnShipmentSave(): void
47
54
),
48
55
new StringContains (
49
56
"Your Shipment # {$ shipment ->getIncrementId ()} for Order # {$ order ->getIncrementId ()}"
57
+ ),
58
+ new StringContains (
59
+ "some_tracking_title "
60
+ ),
61
+ new StringContains (
62
+ "some_racking_number "
63
+ ),
64
+ new StringContains (
65
+ "shipping/tracking/popup?hash= "
50
66
)
51
67
);
52
68
You can’t perform that action at this time.
0 commit comments