woocommerce-paypal-payments/tests/PHPUnit/WcGateway/Assets/SettingsPagesAssetsTest.php

43 lines
1.2 KiB
PHP
Raw Normal View History

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;
use WooCommerce\PayPalCommerce\Onboarding\Environment;
2022-09-02 14:09:51 +02:00
use WooCommerce\PayPalCommerce\Subscription\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);
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',
Mockery::mock(Environment::class),
2022-11-10 15:18:57 +04:00
true,
array(),
array()
);
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
}