diff --git a/tests/Behat/Context/Application/ManagingInvoicesContext.php b/tests/Behat/Context/Application/ManagingInvoicesContext.php index 765d8128..deed9aa7 100644 --- a/tests/Behat/Context/Application/ManagingInvoicesContext.php +++ b/tests/Behat/Context/Application/ManagingInvoicesContext.php @@ -1,11 +1,19 @@ invoiceRepository->findOneByOrder($order); - $filePath = $this->invoicesSavePath.'/'.str_replace('/', '_', $invoice->number()).'.pdf'; + $filePath = $this->invoicesSavePath . '/' . str_replace('/', '_', $invoice->number()) . '.pdf'; Assert::true(file_exists($filePath)); } diff --git a/tests/Behat/Context/Cli/InvoicesGenerationContext.php b/tests/Behat/Context/Cli/InvoicesGenerationContext.php index 81664f19..5e289919 100644 --- a/tests/Behat/Context/Cli/InvoicesGenerationContext.php +++ b/tests/Behat/Context/Cli/InvoicesGenerationContext.php @@ -1,5 +1,14 @@ kernel = $kernel; $this->massInvoicesCreator = $massInvoicesCreator; @@ -46,8 +55,8 @@ public function generateInvoicesForPreviouslyPlacedOrders(): void $application->add( new GenerateInvoicesCommand( $this->massInvoicesCreator, - $this->orderRepository - ) + $this->orderRepository, + ), ); /** @var Command $command */ diff --git a/tests/Behat/Context/Domain/InvoiceEmailContext.php b/tests/Behat/Context/Domain/InvoiceEmailContext.php index c3684bfc..084b5bad 100644 --- a/tests/Behat/Context/Domain/InvoiceEmailContext.php +++ b/tests/Behat/Context/Domain/InvoiceEmailContext.php @@ -1,5 +1,14 @@ emailChecker->hasMessageTo( sprintf('was generated for order with number %s', $orderNumber), - $recipient + $recipient, )); } } diff --git a/tests/Behat/Context/Hook/InvoicesContext.php b/tests/Behat/Context/Hook/InvoicesContext.php index 08c161d3..bad95c32 100644 --- a/tests/Behat/Context/Hook/InvoicesContext.php +++ b/tests/Behat/Context/Hook/InvoicesContext.php @@ -1,5 +1,14 @@ invoicesSavePath) as $file) { - if (is_file($this->invoicesSavePath.'/'.$file)) { - unlink($this->invoicesSavePath.'/'.$file); + if (is_file($this->invoicesSavePath . '/' . $file)) { + unlink($this->invoicesSavePath . '/' . $file); } } } diff --git a/tests/Behat/Context/Order/OrderContext.php b/tests/Behat/Context/Order/OrderContext.php index c815bff2..10fdce48 100644 --- a/tests/Behat/Context/Order/OrderContext.php +++ b/tests/Behat/Context/Order/OrderContext.php @@ -1,5 +1,14 @@ setCity($city); diff --git a/tests/Behat/Context/Ui/Admin/ManagingChannelsContext.php b/tests/Behat/Context/Ui/Admin/ManagingChannelsContext.php index 087313a6..905d4cb5 100644 --- a/tests/Behat/Context/Ui/Admin/ManagingChannelsContext.php +++ b/tests/Behat/Context/Ui/Admin/ManagingChannelsContext.php @@ -1,5 +1,14 @@ updatePage->specifyBillingAddress($street, $postcode, $city, $country->getCode()); } @@ -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())); } diff --git a/tests/Behat/Context/Ui/Admin/ManagingInvoicesContext.php b/tests/Behat/Context/Ui/Admin/ManagingInvoicesContext.php index 8d4b67b7..21995a42 100644 --- a/tests/Behat/Context/Ui/Admin/ManagingInvoicesContext.php +++ b/tests/Behat/Context/Ui/Admin/ManagingInvoicesContext.php @@ -1,5 +1,14 @@ indexPage = $indexPage; $this->showPage = $showPage; @@ -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, ); } @@ -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)); } @@ -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)); } @@ -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), ); } @@ -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)); } @@ -295,7 +304,7 @@ public function shouldBeNotifiedThatEmailWasSentSuccessfully(): void { $this->notificationChecker->checkNotification( 'Invoice has been successfully resent to the customer', - NotificationType::success() + NotificationType::success(), ); } @@ -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, )); } @@ -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, )); } diff --git a/tests/Behat/Context/Ui/Shop/CustomerBrowsingInvoicesContext.php b/tests/Behat/Context/Ui/Shop/CustomerBrowsingInvoicesContext.php index 1f2dafdd..20ff795f 100644 --- a/tests/Behat/Context/Ui/Shop/CustomerBrowsingInvoicesContext.php +++ b/tests/Behat/Context/Ui/Shop/CustomerBrowsingInvoicesContext.php @@ -1,5 +1,14 @@ orderShowPage = $orderShowPage; $this->downloadInvoicePage = $downloadInvoicePage; diff --git a/tests/Behat/Page/Admin/Channel/UpdatePage.php b/tests/Behat/Page/Admin/Channel/UpdatePage.php index 27336092..27449339 100644 --- a/tests/Behat/Page/Admin/Channel/UpdatePage.php +++ b/tests/Behat/Page/Admin/Channel/UpdatePage.php @@ -1,5 +1,14 @@ 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; } diff --git a/tests/Behat/Page/Admin/Invoice/IndexPageInterface.php b/tests/Behat/Page/Admin/Invoice/IndexPageInterface.php index 5565109c..78789f51 100644 --- a/tests/Behat/Page/Admin/Invoice/IndexPageInterface.php +++ b/tests/Behat/Page/Admin/Invoice/IndexPageInterface.php @@ -1,5 +1,14 @@ getElement('billing_address')->getText(); @@ -59,7 +68,7 @@ public function hasShopBillingData( string $countryName, string $street, string $city, - string $postcode + string $postcode, ): bool { $billingDataText = $this->getElement('shop_billing_data')->getText(); @@ -84,8 +93,8 @@ public function hasItemWithData( int $quantity, string $taxTotal, string $total, - string $currencyCode = null, - string $netValue = null + ?string $currencyCode = null, + ?string $netValue = null, ): bool { $row = $this->tableAccessor->getRowsWithFields($this->getElement('table'), [ 'name' => $name, @@ -99,7 +108,7 @@ public function hasItemWithData( return null !== $row; } - public function hasTaxItem(string $label, string $amount, string $currencyCode): bool + public function hasTaxItem(string $label, string $amount, string $currencyCode): bool { foreach ($this->getDocument()->findAll('css', '[data-test-invoice-tax-item]') as $item) { if ( diff --git a/tests/Behat/Page/Admin/Invoice/ShowPageInterface.php b/tests/Behat/Page/Admin/Invoice/ShowPageInterface.php index 34861199..2debfafb 100644 --- a/tests/Behat/Page/Admin/Invoice/ShowPageInterface.php +++ b/tests/Behat/Page/Admin/Invoice/ShowPageInterface.php @@ -1,5 +1,14 @@ assertProcessedConfigurationEquals( [[]], ['pdf_generator' => ['allowed_files' => []]], - 'pdf_generator.allowed_files' + 'pdf_generator.allowed_files', ); } @@ -37,7 +37,7 @@ public function it_allows_to_define_allowed_files(): void $this->assertProcessedConfigurationEquals( [['pdf_generator' => ['allowed_files' => ['swans.png', 'product.png']]]], ['pdf_generator' => ['allowed_files' => ['swans.png', 'product.png']]], - 'pdf_generator.allowed_files' + 'pdf_generator.allowed_files', ); } @@ -47,7 +47,7 @@ public function it_has_enabled_pdf_generator_by_default(): void $this->assertProcessedConfigurationEquals( [], ['pdf_generator' => ['enabled' => true]], - 'pdf_generator.enabled' + 'pdf_generator.enabled', ); } @@ -57,7 +57,7 @@ public function it_allows_to_disable_pdf_generator(): void $this->assertProcessedConfigurationEquals( [['pdf_generator' => ['enabled' => false]]], ['pdf_generator' => ['enabled' => false]], - 'pdf_generator.enabled' + 'pdf_generator.enabled', ); } diff --git a/tests/DependencyInjection/SyliusInvoicingExtensionTest.php b/tests/DependencyInjection/SyliusInvoicingExtensionTest.php index 1eee5b3d..6b4eeca3 100644 --- a/tests/DependencyInjection/SyliusInvoicingExtensionTest.php +++ b/tests/DependencyInjection/SyliusInvoicingExtensionTest.php @@ -42,11 +42,11 @@ public function it_autoconfigures_prepending_doctrine_migration_with_proper_migr $doctrineMigrationsExtensionConfig = $this->container->getExtensionConfig('doctrine_migrations'); self::assertTrue(isset( - $doctrineMigrationsExtensionConfig[0]['migrations_paths']['Sylius\InvoicingPlugin\Migrations'] + $doctrineMigrationsExtensionConfig[0]['migrations_paths']['Sylius\InvoicingPlugin\Migrations'], )); self::assertSame( '@SyliusInvoicingPlugin/src/Migrations', - $doctrineMigrationsExtensionConfig[0]['migrations_paths']['Sylius\InvoicingPlugin\Migrations'] + $doctrineMigrationsExtensionConfig[0]['migrations_paths']['Sylius\InvoicingPlugin\Migrations'], ); $syliusLabsDoctrineMigrationsExtraExtensionConfig = $this @@ -55,11 +55,11 @@ public function it_autoconfigures_prepending_doctrine_migration_with_proper_migr ; self::assertTrue(isset( - $syliusLabsDoctrineMigrationsExtraExtensionConfig[0]['migrations']['Sylius\InvoicingPlugin\Migrations'] + $syliusLabsDoctrineMigrationsExtraExtensionConfig[0]['migrations']['Sylius\InvoicingPlugin\Migrations'], )); self::assertSame( 'Sylius\Bundle\CoreBundle\Migrations', - $syliusLabsDoctrineMigrationsExtraExtensionConfig[0]['migrations']['Sylius\InvoicingPlugin\Migrations'][0] + $syliusLabsDoctrineMigrationsExtraExtensionConfig[0]['migrations']['Sylius\InvoicingPlugin\Migrations'][0], ); } @@ -91,7 +91,7 @@ public function it_loads_allowed_files_for_pdf_generator_configuration(): void $this->assertContainerBuilderHasParameter( 'sylius_invoicing.pdf_generator.allowed_files', - ['swans.png', 'product.png'] + ['swans.png', 'product.png'], ); } @@ -100,7 +100,7 @@ public function it_prepends_configuration_with_enabled_pdf_generator(): void { $this->container->prependExtensionConfig( 'sylius_invoicing', - ['pdf_generator' => ['enabled' => false]] + ['pdf_generator' => ['enabled' => false]], ); $this->prepend(); @@ -330,12 +330,12 @@ public function it_prepends_configuration_with_invoice_resource_services(): void $this->assertContainerBuilderHasParameter( 'sylius_invoicing.model.invoice.class', - Invoice::class + Invoice::class, ); $this->assertContainerBuilderHasService( 'sylius_invoicing.controller.invoice', - ResourceController::class + ResourceController::class, ); } @@ -346,12 +346,12 @@ public function it_prepends_configuration_with_billing_data_resource_services(): $this->assertContainerBuilderHasParameter( 'sylius_invoicing.model.billing_data.class', - BillingData::class + BillingData::class, ); $this->assertContainerBuilderHasService( 'sylius_invoicing.controller.billing_data', - ResourceController::class + ResourceController::class, ); } @@ -362,12 +362,12 @@ public function it_prepends_configuration_with_shop_billing_data_resource_servic $this->assertContainerBuilderHasParameter( 'sylius_invoicing.model.shop_billing_data.class', - InvoiceShopBillingData::class + InvoiceShopBillingData::class, ); $this->assertContainerBuilderHasService( 'sylius_invoicing.controller.shop_billing_data', - ResourceController::class + ResourceController::class, ); } @@ -378,12 +378,12 @@ public function it_prepends_configuration_with_line_item_resource_services(): vo $this->assertContainerBuilderHasParameter( 'sylius_invoicing.model.line_item.class', - LineItem::class + LineItem::class, ); $this->assertContainerBuilderHasService( 'sylius_invoicing.controller.line_item', - ResourceController::class + ResourceController::class, ); } @@ -394,12 +394,12 @@ public function it_prepends_configuration_with_tax_item_resource_services(): voi $this->assertContainerBuilderHasParameter( 'sylius_invoicing.model.tax_item.class', - TaxItem::class + TaxItem::class, ); $this->assertContainerBuilderHasService( 'sylius_invoicing.controller.tax_item', - ResourceController::class + ResourceController::class, ); } @@ -410,12 +410,12 @@ public function it_prepends_configuration_with_invoice_sequence_resource_service $this->assertContainerBuilderHasParameter( 'sylius_invoicing.model.invoice_sequence.class', - InvoiceSequence::class + InvoiceSequence::class, ); $this->assertContainerBuilderHasService( 'sylius_invoicing.controller.invoice_sequence', - ResourceController::class + ResourceController::class, ); }