2021-03-25 15:10:53 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace WooCommerce\PayPalCommerce\WcGateway\Assets;
|
|
|
|
|
2021-06-04 11:57:25 +02:00
|
|
|
use WooCommerce\PayPalCommerce\ApiClient\Authentication\Bearer;
|
2024-02-15 16:10:56 +01:00
|
|
|
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\BillingAgreementsEndpoint;
|
2023-02-14 11:25:23 +02:00
|
|
|
use WooCommerce\PayPalCommerce\Onboarding\Environment;
|
2023-10-18 17:15:27 +02:00
|
|
|
use WooCommerce\PayPalCommerce\WcSubscriptions\Helper\SubscriptionHelper;
|
2021-03-25 15:10:53 +02:00
|
|
|
use WooCommerce\PayPalCommerce\TestCase;
|
|
|
|
use function Brain\Monkey\Functions\when;
|
2021-06-04 11:57:25 +02:00
|
|
|
use Mockery;
|
2021-03-25 15:10:53 +02:00
|
|
|
|
|
|
|
class SettingsPagesAssetsTest extends TestCase
|
|
|
|
{
|
|
|
|
public function testRegisterAssets()
|
|
|
|
{
|
|
|
|
$moduleUrl = 'http://example.com/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-wc-gateway';
|
|
|
|
$modulePath = '/var/www/html/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-wc-gateway';
|
2022-09-02 14:09:51 +02:00
|
|
|
$subscriptionsHelper = Mockery::mock(SubscriptionHelper::class);
|
2024-02-15 16:10:56 +01:00
|
|
|
$billingAgreementEndpoint = Mockery::mock(BillingAgreementsEndpoint::class);
|
|
|
|
|
2021-03-25 15:10:53 +02:00
|
|
|
|
2022-11-10 15:18:57 +04:00
|
|
|
$testee = new SettingsPageAssets(
|
|
|
|
$moduleUrl,
|
|
|
|
$modulePath,
|
|
|
|
$subscriptionsHelper,
|
|
|
|
'123',
|
|
|
|
'EUR',
|
|
|
|
'DE',
|
2023-02-14 11:25:23 +02:00
|
|
|
Mockery::mock(Environment::class),
|
2022-11-10 15:18:57 +04:00
|
|
|
true,
|
2022-11-17 16:58:58 +04:00
|
|
|
array(),
|
2023-08-11 11:36:20 +01:00
|
|
|
array(),
|
2023-11-08 09:46:52 +02:00
|
|
|
true,
|
2024-02-15 16:10:56 +01:00
|
|
|
false,
|
2024-06-13 11:35:05 +02:00
|
|
|
$billingAgreementEndpoint,
|
|
|
|
true
|
2023-08-11 11:36:20 +01:00
|
|
|
);
|
2021-03-25 15:10:53 +02:00
|
|
|
|
|
|
|
when('is_admin')
|
|
|
|
->justReturn(true);
|
2022-01-18 13:40:50 +02:00
|
|
|
when('wp_doing_ajax')
|
2021-03-25 15:10:53 +02:00
|
|
|
->justReturn(false);
|
|
|
|
|
|
|
|
$testee->register_assets();
|
|
|
|
|
|
|
|
self::assertSame(has_action('admin_enqueue_scripts', "function()"), 10);
|
|
|
|
}
|
2021-03-25 17:08:55 +02:00
|
|
|
}
|