Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 51cc069

Browse files
authored
feature #11089 [Shipment] Add date when shipment has been shipped (AdamKasp, GSadee)
This PR was merged into the 1.7-dev branch. Discussion ---------- | Q | A | --------------- | ----- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | License | MIT ![Screenshot 2020-02-11 at 09 27 00](https://user-images.githubusercontent.com/29897151/74220796-cd449380-4cb0-11ea-9fe5-37782afd8db1.png) ![Screenshot 2020-02-03 at 11 19 53](https://user-images.githubusercontent.com/29897151/73645251-37d54e00-4677-11ea-9261-9c1c620c66d5.png) <!-- - Bug fixes must be submitted against the 1.6 branch (the lowest possible) - Features and deprecations must be submitted against the master branch - Make sure that the correct base branch is set --> Commits ------- d36d4a4 Add shippedAt date on shipment 7aa394d [Shipment] Fixes for setting shipped at date feature
2 parents b22c6c5 + 7aa394d commit 51cc069

32 files changed

Lines changed: 427 additions & 6 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Sylius\Migrations;
6+
7+
use Doctrine\DBAL\Schema\Schema;
8+
use Doctrine\Migrations\AbstractMigration;
9+
10+
final class Version20200202104152 extends AbstractMigration
11+
{
12+
public function up(Schema $schema): void
13+
{
14+
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
15+
16+
$this->addSql('ALTER TABLE sylius_shipment ADD shipped_at DATETIME DEFAULT NULL');
17+
}
18+
19+
public function down(Schema $schema): void
20+
{
21+
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
22+
23+
$this->addSql('ALTER TABLE sylius_shipment DROP shipped_at');
24+
}
25+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
@managing_orders
2+
Feature: Seeing shipment shipping date
3+
In order to get to know when shipment has been shipped
4+
As an Administrator
5+
I want to be able to see shipment shipping date
6+
7+
Background:
8+
Given the store operates on a single channel in "United States"
9+
And the store has a product "Gryffindor scarf" priced at "$100.00"
10+
And the store has "Owl post" shipping method with "$10.00" fee within the "US" zone
11+
And the store allows paying offline
12+
And there is a customer "[email protected]" that placed an order "#00000777"
13+
And the customer bought a single "Gryffindor scarf"
14+
And the customer chose "Owl post" shipping method to "United States" with "Offline" payment
15+
And it is "20-02-2020 10:30:05" now
16+
And I am logged in as an administrator
17+
18+
@ui
19+
Scenario: Seeing shipped at date
20+
When I view the summary of the order "#00000777"
21+
And I ship this order
22+
Then I should see the shipping date as "20-02-2020 10:30:05"

features/shipping/managing_shipments/managing_of_shipments_status.feature renamed to features/shipping/managing_shipments/shipping_a_shipment_from_shipment_list.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,11 @@ Feature: Shipping a shipment from shipment list
2929
And I ship the shipment of order "#00000001" with "AWDDXS-SAAQQ-SEFFX-CCDSE" tracking code
3030
Then I should be notified that the shipment has been successfully shipped
3131
And an email with the shipment's confirmation of the order "#00000001" should be sent to "[email protected]"
32+
33+
@ui
34+
Scenario: Setting date when a shipment has been shipped
35+
Given it is "20-02-2020 10:30:05" now
36+
When I browse shipments
37+
And I ship the shipment of order "#00000001"
38+
Then I should see the shipment of order "#00000001" as "Shipped"
39+
And I should see the shipment of order "#00000001" shipped at "20-02-2020 10:30:05"

psalm.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<directory name="src/Sylius/Bundle/PromotionBundle/test" />
4545
<directory name="src/Sylius/Bundle/PromotionBundle/Tests" />
4646
<directory name="src/Sylius/Bundle/ReviewBundle/spec" />
47+
<directory name="src/Sylius/Bundle/ShippingBundle/spec" />
4748
<directory name="src/Sylius/Bundle/ShippingBundle/test" />
4849
<directory name="src/Sylius/Bundle/ShopBundle/spec" />
4950
<directory name="src/Sylius/Bundle/TaxationBundle/spec" />
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Sylius package.
5+
*
6+
* (c) Paweł Jędrzejewski
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace Sylius\Behat\Context\Hook;
15+
16+
use Behat\Behat\Context\Context;
17+
18+
final class CalendarContext implements Context
19+
{
20+
/** @var string */
21+
private $projectDirectory;
22+
23+
public function __construct(string $projectDirectory)
24+
{
25+
$this->projectDirectory = $projectDirectory;
26+
}
27+
28+
/**
29+
* @AfterScenario
30+
*/
31+
public function deleteTemporaryDate(): void
32+
{
33+
if (file_exists($this->projectDirectory . '/var/temporaryDate.txt')) {
34+
unlink($this->projectDirectory . '/var/temporaryDate.txt');
35+
}
36+
}
37+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Sylius package.
5+
*
6+
* (c) Paweł Jędrzejewski
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace Sylius\Behat\Context\Setup;
15+
16+
use Behat\Behat\Context\Context;
17+
18+
final class CalendarContext implements Context
19+
{
20+
/** @var string */
21+
private $projectDirectory;
22+
23+
public function __construct(string $projectDirectory)
24+
{
25+
$this->projectDirectory = $projectDirectory;
26+
}
27+
28+
/**
29+
* @Given it is :dateTime now
30+
*/
31+
public function itIsNow(string $dateTime): void
32+
{
33+
file_put_contents($this->projectDirectory . '/var/temporaryDate.txt', $dateTime);
34+
}
35+
}

src/Sylius/Behat/Context/Ui/Admin/ManagingOrdersContext.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,14 @@ public function iShouldBeNotifiedThatTheOrderConfirmationEmailHasBeenSuccessfull
908908
);
909909
}
910910

911+
/**
912+
* @Then I should see the shipping date as :dateTime
913+
*/
914+
public function iShouldSeeTheShippingDateAs(string $dateTime): void
915+
{
916+
Assert::same($this->showPage->getShippedAtDate(), $dateTime);
917+
}
918+
911919
/**
912920
* @param string $type
913921
* @param string $element

src/Sylius/Behat/Context/Ui/Admin/ManagingShipmentsContext.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,12 @@ public function iShouldSeeUnitsInTheList(int $amount, string $productName): void
201201
{
202202
Assert::same($this->showPage->getAmountOfUnits($productName), $amount);
203203
}
204+
205+
/**
206+
* @Then I should see the shipment of order :orderNumber shipped at :dateTime
207+
*/
208+
public function iShouldSeeTheShippingDateeAs(string $orderNumber, string $dateTme): void
209+
{
210+
Assert::same($this->indexPage->getShippedAtDate($orderNumber), $dateTme);
211+
}
204212
}

src/Sylius/Behat/Page/Admin/Order/ShowPage.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,11 @@ public function resendShipmentConfirmationEmail(): void
377377
$this->getElement('resend_shipment_confirmation_email')->click();
378378
}
379379

380+
public function getShippedAtDate(): string
381+
{
382+
return $this->getElement('shipment_shipped_at_date')->getText();
383+
}
384+
380385
protected function getDefinedElements(): array
381386
{
382387
return array_merge(parent::getDefinedElements(), [
@@ -395,6 +400,7 @@ protected function getDefinedElements(): array
395400
'promotion_total' => '#promotion-total',
396401
'resend_order_confirmation_email' => '[data-test-resend-order-confirmation-email]',
397402
'resend_shipment_confirmation_email' => '[data-test-resend-shipment-confirmation-email]',
403+
'shipment_shipped_at_date' => '#sylius-shipments .shipped-at-date',
398404
'shipments' => '#sylius-shipments',
399405
'shipping_address' => '#shipping-address',
400406
'shipping_adjustment_name' => '#shipping-adjustment-label',

src/Sylius/Behat/Page/Admin/Order/ShowPageInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,6 @@ public function hasInformationAboutNoPayment(): bool;
119119
public function resendOrderConfirmationEmail(): void;
120120

121121
public function resendShipmentConfirmationEmail(): void;
122+
123+
public function getShippedAtDate(): string;
122124
}

0 commit comments

Comments
 (0)