Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions tests/Behat/Context/Application/ManagingInvoicesContext.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Tests\Sylius\InvoicingPlugin\Behat\Context\Application;

use Behat\Behat\Context\Context;
use Behat\Behat\Tester\Exception\PendingException;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\InvoicingPlugin\Doctrine\ORM\InvoiceRepositoryInterface;
use Sylius\InvoicingPlugin\Entity\InvoiceInterface;
Expand All @@ -30,7 +38,7 @@ public function theInvoiceForOrderShouldBeSavedOnTheServer(OrderInterface $order
{
/** @var InvoiceInterface $invoice */
$invoice = $this->invoiceRepository->findOneByOrder($order);
$filePath = $this->invoicesSavePath.'/'.str_replace('/', '_', $invoice->number()).'.pdf';
$filePath = $this->invoicesSavePath . '/' . str_replace('/', '_', $invoice->number()) . '.pdf';

Assert::true(file_exists($filePath));
}
Expand Down
15 changes: 12 additions & 3 deletions tests/Behat/Context/Cli/InvoicesGenerationContext.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Tests\Sylius\InvoicingPlugin\Behat\Context\Cli;
Expand Down Expand Up @@ -28,7 +37,7 @@ public function __construct(
KernelInterface $kernel,
MassInvoicesCreatorInterface $massInvoicesCreator,
InvoiceRepositoryInterface $invoiceRepository,
OrderRepositoryInterface $orderRepository
OrderRepositoryInterface $orderRepository,
) {
$this->kernel = $kernel;
$this->massInvoicesCreator = $massInvoicesCreator;
Expand All @@ -46,8 +55,8 @@ public function generateInvoicesForPreviouslyPlacedOrders(): void
$application->add(
new GenerateInvoicesCommand(
$this->massInvoicesCreator,
$this->orderRepository
)
$this->orderRepository,
),
);

/** @var Command $command */
Expand Down
11 changes: 10 additions & 1 deletion tests/Behat/Context/Domain/InvoiceEmailContext.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Tests\Sylius\InvoicingPlugin\Behat\Context\Domain;
Expand Down Expand Up @@ -32,7 +41,7 @@ public function emailContainingInvoiceForOrderShouldNotBeSent(string $orderNumbe
{
Assert::false($this->emailChecker->hasMessageTo(
sprintf('was generated for order with number %s', $orderNumber),
$recipient
$recipient,
));
}
}
13 changes: 11 additions & 2 deletions tests/Behat/Context/Hook/InvoicesContext.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Tests\Sylius\InvoicingPlugin\Behat\Context\Hook;
Expand All @@ -22,8 +31,8 @@ public function clearInvoicesPath(): void
}

foreach (scandir($this->invoicesSavePath) as $file) {
if (is_file($this->invoicesSavePath.'/'.$file)) {
unlink($this->invoicesSavePath.'/'.$file);
if (is_file($this->invoicesSavePath . '/' . $file)) {
unlink($this->invoicesSavePath . '/' . $file);
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions tests/Behat/Context/Order/OrderContext.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Tests\Sylius\InvoicingPlugin\Behat\Context\Order;
Expand Down
11 changes: 10 additions & 1 deletion tests/Behat/Context/Setup/ChannelContext.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Tests\Sylius\InvoicingPlugin\Behat\Context\Setup;
Expand Down Expand Up @@ -30,7 +39,7 @@ public function setShopBillingDataForChannel(
string $street,
string $postcode,
string $city,
CountryInterface $country
CountryInterface $country,
): void {
$shopBillingData = new ShopBillingData();
$shopBillingData->setCity($city);
Expand Down
13 changes: 11 additions & 2 deletions tests/Behat/Context/Ui/Admin/ManagingChannelsContext.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Tests\Sylius\InvoicingPlugin\Behat\Context\Ui\Admin;
Expand Down Expand Up @@ -41,7 +50,7 @@ public function specifyShopBillingAddressAs(
string $street,
string $postcode,
string $city,
CountryInterface $country
CountryInterface $country,
): void {
$this->updatePage->specifyBillingAddress($street, $postcode, $city, $country->getCode());
}
Expand Down Expand Up @@ -69,7 +78,7 @@ public function thisChannelShopBillingAddressShouldBe(
string $street,
string $postcode,
string $city,
CountryInterface $country
CountryInterface $country,
): void {
Assert::true($this->updatePage->hasBillingAddress($street, $postcode, $city, $country->getCode()));
}
Expand Down
47 changes: 35 additions & 12 deletions tests/Behat/Context/Ui/Admin/ManagingInvoicesContext.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Tests\Sylius\InvoicingPlugin\Behat\Context\Ui\Admin;
Expand Down Expand Up @@ -31,7 +40,7 @@ public function __construct(
ShowPageInterface $showPage,
OrderShowPageInterface $orderShowPage,
InvoiceRepositoryInterface $invoiceRepository,
NotificationCheckerInterface $notificationChecker
NotificationCheckerInterface $notificationChecker,
) {
$this->indexPage = $indexPage;
$this->showPage = $showPage;
Expand Down Expand Up @@ -99,7 +108,7 @@ public function viewSummaryOfInvoiceForOrder(OrderInterface $order): void
public function shouldBeIssuedInTheLastHour(): void
{
Assert::true(
((new \DateTimeImmutable('now'))->getTimestamp() - $this->showPage->getIssuedAtDate()->getTimestamp()) <= 3600
((new \DateTimeImmutable('now'))->getTimestamp() - $this->showPage->getIssuedAtDate()->getTimestamp()) <= 3600,
);
}

Expand Down Expand Up @@ -160,7 +169,7 @@ public function itShouldHaveBillingDataAs(
string $street,
string $postcode,
string $city,
string $countryName
string $countryName,
): void {
Assert::true($this->showPage->hasBillingData($customerName, $street, $postcode, $city, $countryName));
}
Expand All @@ -175,7 +184,7 @@ public function itShouldHaveShopBillingDataAs(
string $countryName,
string $street,
string $postcode,
string $city
string $city,
): void {
Assert::true($this->showPage->hasShopBillingData($company, $taxId, $countryName, $street, $city, $postcode));
}
Expand All @@ -196,10 +205,10 @@ public function itShouldHaveAnItemWithData(
string $unitPrice,
int $quantity,
string $taxTotal,
string $total
string $total,
): void {
Assert::true(
$this->showPage->hasItemWithData(sprintf('%s (%s)', $name, $name), $unitPrice, $unitPrice, $quantity, $taxTotal, $total)
$this->showPage->hasItemWithData(sprintf('%s (%s)', $name, $name), $unitPrice, $unitPrice, $quantity, $taxTotal, $total),
);
}

Expand Down Expand Up @@ -243,7 +252,7 @@ public function itShouldHaveAShippingItemWithData(
string $unitPrice,
int $quantity,
string $taxTotal,
string $total
string $total,
): void {
Assert::true($this->showPage->hasItemWithData($name, $unitPrice, $unitPrice, $quantity, $taxTotal, $total));
}
Expand Down Expand Up @@ -295,7 +304,7 @@ public function shouldBeNotifiedThatEmailWasSentSuccessfully(): void
{
$this->notificationChecker->checkNotification(
'Invoice has been successfully resent to the customer',
NotificationType::success()
NotificationType::success(),
);
}

Expand All @@ -310,10 +319,17 @@ public function itShouldHaveShipmentWithUnitNetPriceDiscountedUnitPriceNetValueT
string $netValue,
string $taxTotal,
string $total,
string $currencyCode
string $currencyCode,
): void {
Assert::true($this->showPage->hasItemWithData(
$name, $unitNetPrice, $discountedUnitNetPrice, $quantity, $taxTotal, $total, $currencyCode, $netValue
$name,
$unitNetPrice,
$discountedUnitNetPrice,
$quantity,
$taxTotal,
$total,
$currencyCode,
$netValue,
));
}

Expand All @@ -329,10 +345,17 @@ public function itShouldHaveItemsWithUnitNetPriceDiscountedUnitPriceNetValueTaxT
string $netValue,
string $taxTotal,
string $total,
string $currencyCode
string $currencyCode,
): void {
Assert::true($this->showPage->hasItemWithData(
$name, $unitNetPrice, $discountedUnitNetPrice, $quantity, $taxTotal, $total, $currencyCode, $netValue
$name,
$unitNetPrice,
$discountedUnitNetPrice,
$quantity,
$taxTotal,
$total,
$currencyCode,
$netValue,
));
}

Expand Down
11 changes: 10 additions & 1 deletion tests/Behat/Context/Ui/Shop/CustomerBrowsingInvoicesContext.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Tests\Sylius\InvoicingPlugin\Behat\Context\Ui\Shop;
Expand All @@ -22,7 +31,7 @@ final class CustomerBrowsingInvoicesContext implements Context
public function __construct(
ShowPageInterface $orderShowPage,
DownloadInvoicePageInterface $downloadInvoicePage,
InvoiceRepositoryInterface $invoiceRepository
InvoiceRepositoryInterface $invoiceRepository,
) {
$this->orderShowPage = $orderShowPage;
$this->downloadInvoicePage = $downloadInvoicePage;
Expand Down
9 changes: 9 additions & 0 deletions tests/Behat/Page/Admin/Channel/UpdatePage.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Tests\Sylius\InvoicingPlugin\Behat\Page\Admin\Channel;
Expand Down
9 changes: 9 additions & 0 deletions tests/Behat/Page/Admin/Channel/UpdatePageInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Tests\Sylius\InvoicingPlugin\Behat\Page\Admin\Channel;
Expand Down
11 changes: 10 additions & 1 deletion tests/Behat/Page/Admin/Invoice/IndexPage.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Tests\Sylius\InvoicingPlugin\Behat\Page\Admin\Invoice;
Expand All @@ -15,7 +24,7 @@ public function hasInvoiceForOrder(string $orderNumber): bool

public function hasInvoiceWithChannel(int $index, string $channel): bool
{
$invoice = $this->getDocument()->findAll('css', 'table tbody tr')[$index-1];
$invoice = $this->getDocument()->findAll('css', 'table tbody tr')[$index - 1];

return $invoice->find('css', sprintf('td:contains("%s")', $channel)) !== null;
}
Expand Down
Loading
Loading