Skip to content

Commit 56a7e12

Browse files
committed
Review
1 parent 6bbab75 commit 56a7e12

File tree

4 files changed

+14
-26
lines changed

4 files changed

+14
-26
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"sylius/sylius": "~1.11.2",
1010
"symfony/config": "^5.4",
1111
"symfony/dependency-injection": "^5.4",
12+
"symfony/expression-language": "^5.4",
1213
"symfony/event-dispatcher-contracts": "^2.5",
1314
"symfony/form": "^5.4",
1415
"symfony/framework-bundle": "^5.4",

src/Resources/config/services.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use BabDev\SyliusShippingEstimatePlugin\Controller\ShippingEstimatorController;
88
use BabDev\SyliusShippingEstimatePlugin\Form\Type\ShippingEstimatorType;
9-
use Sylius\Component\Shipping\Calculator\DelegatingCalculatorInterface;
109

1110
return static function (ContainerConfigurator $container): void {
1211
$services = $container->services();
@@ -20,7 +19,7 @@
2019
service('sylius.factory.address'),
2120
service('sylius.factory.adjustment'),
2221
service('sylius.shipping_methods_resolver'),
23-
service(DelegatingCalculatorInterface::class),
22+
service('sylius.shipping_calculator'),
2423
service('sylius.money_formatter'),
2524
service('event_dispatcher'),
2625
])

tests/Behat/Context/Ui/Shop/ShippingEstimatorContext.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ public function customerSeesTheShippingEstimator(): void
3333
/**
3434
* @When I choose :countryName as my country
3535
*/
36-
public function iChooseAsMyCountry($countryName): void
36+
public function iChooseAsMyCountry(string $countryName): void
3737
{
3838
$this->summaryPage->selectCountry($countryName);
3939
}
4040

4141
/**
4242
* @When I specify :postcode as my postcode
4343
*/
44-
public function iSpecifyAsMyPostcode($postcode): void
44+
public function iSpecifyAsMyPostcode(string $postcode): void
4545
{
4646
$this->summaryPage->specifyPostcode($postcode);
4747
}
@@ -89,8 +89,8 @@ public function theNoShippingOptionsMessageIsNotVisible(): void
8989
/**
9090
* @When I see :count shipping options available
9191
*/
92-
public function iSeeShippingOptions($count): void
92+
public function iSeeShippingOptions(int $count): void
9393
{
94-
$this->summaryPage->seeShippingOptions((int) $count);
94+
$this->summaryPage->seeShippingOptions($count);
9595
}
9696
}

tests/Behat/Page/Shop/SummaryPage.php

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,56 +16,44 @@ public function hasShippingEstimator(): bool
1616

1717
public function doesNotHaveAddressMessage(): bool
1818
{
19-
$message = $this->getElement('enter_address_message');
20-
21-
return $message->hasClass('hidden');
19+
return $this->getElement('enter_address_message')->hasClass('hidden');
2220
}
2321

2422
public function hasAddressMessage(): bool
2523
{
26-
$message = $this->getElement('enter_address_message');
27-
28-
return !$message->hasClass('hidden');
24+
return !$this->getElement('enter_address_message')->hasClass('hidden');
2925
}
3026

3127
public function doesNotHaveNoShippingOptionsMessage(): bool
3228
{
33-
$message = $this->getElement('no_shipping_options_message');
34-
35-
return $message->hasClass('hidden');
29+
return $this->getElement('no_shipping_options_message')->hasClass('hidden');
3630
}
3731

3832
public function hasNoShippingOptionsMessage(): bool
3933
{
40-
$message = $this->getElement('no_shipping_options_message');
41-
42-
return !$message->hasClass('hidden');
34+
return !$this->getElement('no_shipping_options_message')->hasClass('hidden');
4335
}
4436

4537
public function seeShippingOptions(int $count): bool
4638
{
47-
$table = $this->getElement('shipping_options_table');
48-
$options = $table->findAll('css', 'tbody tr');
39+
$options = $this->getElement('shipping_options_table')->findAll('css', 'tbody tr');
4940

5041
return count($options) === $count;
5142
}
5243

5344
public function selectCountry(string $value): void
5445
{
55-
$country = $this->getElement('shipping_estimator_country');
56-
$country->selectOption($value);
46+
$this->getElement('shipping_estimator_country')->selectOption($value);
5747
}
5848

5949
public function specifyPostcode(string $value): void
6050
{
61-
$postcode = $this->getElement('shipping_estimator_postcode');
62-
$postcode->setValue($value);
51+
$this->getElement('shipping_estimator_postcode')->setValue($value);
6352
}
6453

6554
public function clickEstimateShippingButton(): void
6655
{
67-
$button = $this->getElement('estimate_shipping_button');
68-
$button->click();
56+
$this->getElement('estimate_shipping_button')->click();
6957

7058
JQueryHelper::waitForFormToStopLoading($this->getDocument());
7159
}

0 commit comments

Comments
 (0)