woocommerce-paypal-payments/tests/PHPUnit/TestCase.php

54 lines
1.6 KiB
PHP
Raw Permalink Normal View History

2020-04-28 15:03:25 +03:00
<?php
declare(strict_types=1);
2020-09-14 07:51:45 +03:00
namespace WooCommerce\PayPalCommerce;
2020-04-28 15:03:25 +03:00
2021-08-27 20:10:57 +03:00
use function Brain\Monkey\Functions\when;
2020-04-28 15:03:25 +03:00
use function Brain\Monkey\setUp;
use function Brain\Monkey\tearDown;
use Mockery;
class TestCase extends \PHPUnit\Framework\TestCase
{
2021-09-09 12:14:50 +03:00
public function setUp(): void
{
parent::setUp();
2021-08-27 20:10:57 +03:00
2021-09-09 12:14:50 +03:00
when('__')->returnArg();
when('_x')->returnArg();
2021-08-27 20:41:06 +03:00
when('esc_url')->returnArg();
when('esc_attr')->returnArg();
when('esc_attr__')->returnArg();
when('esc_html')->returnArg();
when('esc_html__')->returnArg();
when('esc_textarea')->returnArg();
when('sanitize_text_field')->returnArg();
2021-09-09 12:14:50 +03:00
when('wp_kses_post')->returnArg();
2021-08-27 20:41:06 +03:00
when('wp_unslash')->returnArg();
2022-02-09 16:28:27 +02:00
when('wc_print_r')->alias(function ($value, bool $return = false) {
return print_r($value, $return);
});
2023-03-14 16:40:20 +02:00
when('wc_string_to_bool')->alias(function ($string) {
return is_bool( $string ) ? $string : ( 'yes' === strtolower( $string ) || 1 === $string || 'true' === strtolower( $string ) || '1' === $string );
});
2024-11-20 10:23:50 +01:00
when('get_file_data')->justReturn(['Version' => '1.0','PluginURI' => 'https://github.com/woocommerce/woocommerce-paypal-payments']);
when('get_plugin_data')->justReturn(['Version' => '1.0']);
2022-02-17 18:56:23 +02:00
when('plugin_basename')->justReturn('woocommerce-paypal-payments/woocommerce-paypal-payments.php');
2023-05-15 11:56:39 +02:00
when('get_transient')->returnArg();
2021-08-27 20:10:57 +03:00
2023-04-25 12:19:44 +02:00
when('wc_clean')->returnArg();
when('get_transient')->returnArg();
when('delete_transient')->returnArg();
2023-08-18 16:36:32 +02:00
when('wcs_get_subscription')->returnArg();
2023-04-25 12:19:44 +02:00
2021-09-09 12:14:50 +03:00
setUp();
}
2020-04-28 15:03:25 +03:00
2021-09-09 12:14:50 +03:00
public function tearDown(): void
{
tearDown();
Mockery::close();
parent::tearDown();
}
2020-04-28 15:03:25 +03:00
}