mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Rename e2e to integration
This commit is contained in:
parent
78ba28c04b
commit
129eec6baa
16 changed files with 79 additions and 39 deletions
40
.env.integration
Normal file
40
.env.integration
Normal file
|
@ -0,0 +1,40 @@
|
|||
PPCP_INTEGRATION_WP_DIR=${ROOT_DIR}/.ddev/wordpress
|
||||
|
||||
BASEURL="https://woocommerce-paypal-payments.ddev.site"
|
||||
AUTHORIZATION="Bearer ABC123"
|
||||
|
||||
CHECKOUT_URL="/checkout"
|
||||
CHECKOUT_PAGE_ID=7
|
||||
CART_URL="/cart"
|
||||
BLOCK_CHECKOUT_URL="/checkout-block"
|
||||
BLOCK_CHECKOUT_PAGE_ID=22
|
||||
BLOCK_CART_URL="/cart-block"
|
||||
|
||||
PRODUCT_URL="/product/prod"
|
||||
PRODUCT_ID=123
|
||||
|
||||
SUBSCRIPTION_URL="/product/sub"
|
||||
|
||||
PAYPAL_SUBSCRIPTIONS_PRODUCT_ID=252
|
||||
|
||||
APM_ID="sofort"
|
||||
|
||||
WP_MERCHANT_USER="admin"
|
||||
WP_MERCHANT_PASSWORD="admin"
|
||||
|
||||
WP_CUSTOMER_USER="customer"
|
||||
WP_CUSTOMER_PASSWORD="password"
|
||||
|
||||
CUSTOMER_EMAIL="customer@example.com"
|
||||
CUSTOMER_PASSWORD="password"
|
||||
CUSTOMER_FIRST_NAME="John"
|
||||
CUSTOMER_LAST_NAME="Doe"
|
||||
CUSTOMER_COUNTRY="DE"
|
||||
CUSTOMER_ADDRESS="street 1"
|
||||
CUSTOMER_POSTCODE="12345"
|
||||
CUSTOMER_CITY="city"
|
||||
CUSTOMER_PHONE="1234567890"
|
||||
|
||||
CREDIT_CARD_NUMBER="1234567890"
|
||||
CREDIT_CARD_EXPIRATION="01/2042"
|
||||
CREDIT_CARD_CVV="123"
|
|
@ -1,4 +1,4 @@
|
|||
PPCP_E2E_WP_DIR=${ROOT_DIR}/.ddev/wordpress
|
||||
PPCP_INTEGRATION_WP_DIR=${ROOT_DIR}/.ddev/wordpress
|
||||
|
||||
BASEURL="https://woocommerce-paypal-payments.ddev.site"
|
||||
AUTHORIZATION="Bearer ABC123"
|
|
@ -1,4 +1,4 @@
|
|||
name: e2e tests
|
||||
name: Integration tests
|
||||
|
||||
on: workflow_dispatch
|
||||
|
||||
|
@ -30,10 +30,10 @@ jobs:
|
|||
run: ddev orchestrate -f
|
||||
|
||||
- name: Create config
|
||||
run: cp -n .env.e2e.example .env.e2e
|
||||
run: cp -n .env.integration.example .env.integration
|
||||
|
||||
- name: Setup tests
|
||||
run: ddev php tests/e2e/PHPUnit/setup.php
|
||||
run: ddev php tests/integration/PHPUnit/setup.php
|
||||
|
||||
- name: Run PHPUnit
|
||||
run: ddev exec phpunit -c tests/e2e/phpunit.xml.dist
|
||||
run: ddev exec phpunit -c tests/integration/phpunit.xml.dist
|
|
@ -41,7 +41,7 @@
|
|||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"WooCommerce\\PayPalCommerce\\": "tests/PHPUnit/",
|
||||
"WooCommerce\\PayPalCommerce\\Tests\\E2e\\": "tests/e2e/PHPUnit/"
|
||||
"WooCommerce\\PayPalCommerce\\Tests\\Integration\\": "tests/integration/PHPUnit/"
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
define('E2E_TESTS_ROOT_DIR', dirname(__DIR__));
|
||||
define('ROOT_DIR', dirname(dirname(E2E_TESTS_ROOT_DIR)));
|
||||
|
||||
require_once ROOT_DIR . '/vendor/autoload.php';
|
||||
|
||||
if (file_exists(ROOT_DIR . '/.env.e2e')) {
|
||||
$dotenv = Dotenv\Dotenv::createImmutable(ROOT_DIR, '.env.e2e');
|
||||
$dotenv->load();
|
||||
}
|
||||
|
||||
if (!isset($_ENV['PPCP_E2E_WP_DIR'])) {
|
||||
exit('Copy .env.e2e.example to .env.e2e or define the environment variables.' . PHP_EOL);
|
||||
}
|
||||
$wpRootDir = str_replace('${ROOT_DIR}', ROOT_DIR, $_ENV['PPCP_E2E_WP_DIR']);
|
||||
|
||||
define('WP_ROOT_DIR', $wpRootDir);
|
||||
|
||||
$_SERVER['HTTP_HOST'] = ''; // just to avoid a warning
|
||||
|
||||
require_once WP_ROOT_DIR . '/wp-load.php';
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Tests\E2e\Order;
|
||||
namespace WooCommerce\PayPalCommerce\Tests\Integration\Order;
|
||||
|
||||
use Exception;
|
||||
use WC_Cart;
|
||||
|
@ -15,7 +15,7 @@ use WC_Product;
|
|||
use WC_Product_Simple;
|
||||
use WC_Session;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
|
||||
use WooCommerce\PayPalCommerce\Tests\E2e\TestCase;
|
||||
use WooCommerce\PayPalCommerce\Tests\Integration\TestCase;
|
||||
|
||||
class PurchaseUnitTest extends TestCase
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Tests\E2e;
|
||||
namespace WooCommerce\PayPalCommerce\Tests\Integration;
|
||||
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\Orders;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Tests\E2e;
|
||||
namespace WooCommerce\PayPalCommerce\Tests\Integration;
|
||||
|
||||
use WC_Product_Simple;
|
||||
use WooCommerce\PayPalCommerce\PayPalSubscriptions\RenewalHandler;
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Tests\E2e;
|
||||
namespace WooCommerce\PayPalCommerce\Tests\Integration;
|
||||
|
||||
use WC_Payment_Token_CC;
|
||||
use WC_Payment_Tokens;
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Tests\E2e;
|
||||
namespace WooCommerce\PayPalCommerce\Tests\Integration;
|
||||
|
||||
use Mockery;
|
||||
use WooCommerce\PayPalCommerce\Compat\Settings\GeneralSettingsMapHelper;
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Tests\E2e;
|
||||
namespace WooCommerce\PayPalCommerce\Tests\Integration;
|
||||
|
||||
use WooCommerce\PayPalCommerce\PPCP;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Tests\E2e\Validation;
|
||||
namespace WooCommerce\PayPalCommerce\Tests\Integration\Validation;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Button\Exception\ValidationException;
|
||||
use WooCommerce\PayPalCommerce\Button\Validation\CheckoutFormValidator;
|
||||
use WooCommerce\PayPalCommerce\Tests\E2e\TestCase;
|
||||
use WooCommerce\PayPalCommerce\Tests\Integration\TestCase;
|
||||
|
||||
class ValidationTest extends TestCase
|
||||
{
|
23
tests/integration/PHPUnit/bootstrap.php
Normal file
23
tests/integration/PHPUnit/bootstrap.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
define('INTEGRATION_TESTS_ROOT_DIR', dirname(__DIR__));
|
||||
define('ROOT_DIR', dirname(dirname(INTEGRATION_TESTS_ROOT_DIR)));
|
||||
|
||||
require_once ROOT_DIR . '/vendor/autoload.php';
|
||||
|
||||
if (file_exists(ROOT_DIR . '/.env.integration')) {
|
||||
$dotenv = Dotenv\Dotenv::createImmutable(ROOT_DIR, '.env.integration');
|
||||
$dotenv->load();
|
||||
}
|
||||
|
||||
if (!isset($_ENV['PPCP_INTEGRATION_WP_DIR'])) {
|
||||
exit('Copy .env.integration.example to .env.integration or define the environment variables.' . PHP_EOL);
|
||||
}
|
||||
$wpRootDir = str_replace('${ROOT_DIR}', ROOT_DIR, $_ENV['PPCP_INTEGRATION_WP_DIR']);
|
||||
|
||||
define('WP_ROOT_DIR', $wpRootDir);
|
||||
|
||||
$_SERVER['HTTP_HOST'] = ''; // just to avoid a warning
|
||||
|
||||
require_once WP_ROOT_DIR . '/wp-load.php';
|
|
@ -32,6 +32,6 @@ require WP_ROOT_DIR . '/wp-admin/includes/class-wp-importer.php';
|
|||
require WP_ROOT_DIR . '/wp-content/plugins/woocommerce/includes/admin/importers/class-wc-tax-rate-importer.php';
|
||||
|
||||
$taxImporter = new WC_Tax_Rate_Importer();
|
||||
$taxImporter->import(E2E_TESTS_ROOT_DIR . '/data/tax_rates.csv');
|
||||
$taxImporter->import(INTEGRATION_TESTS_ROOT_DIR . '/data/tax_rates.csv');
|
||||
|
||||
echo PHP_EOL;
|
Loading…
Add table
Add a link
Reference in a new issue