filename
stringlengths
11
137
content
stringlengths
6
292k
projects/plugins/jetpack/tests/php/uninstall/test_uninstall.php
<?php /** * Tests the uninstall functionality. * * @package automattic/jetpack */ /** * Plugin uninstall test case. * * @group uninstall */ class WP_Test_Unistall_Jetpack extends WP_UnitTestCase { /** * Confirms presence of the uninstall file. * * @covers jetpack_uninstall */ public function test_un...
projects/plugins/jetpack/tests/php/lib/class-wp-test-spy-rest-server.php
<?php class WP_Test_Spy_REST_Server extends WP_REST_Server { /** * Get the raw $endpoints data from the server * * @return array */ public function get_raw_endpoint_data() { return $this->endpoints; } /** * Allow calling protected methods from tests * * @param string $method Method to call. * @p...
projects/plugins/jetpack/tests/php/lib/mock-functions.php
<?php /** * Contains functions that need to be (conditionally) mocked. * * @package automattic/jetpack */ if ( ! function_exists( 'wp_cache_is_enabled' ) ) { /** * "Mocking" function so that it exists and Automattic\Jetpack\Sync\Actions will load Automattic\Jetpack\Sync\Modules\WP_Super_Cache. */ function wp...
projects/plugins/jetpack/tests/php/lib/class-wpcom-features.php
<?php /** * WPCOM_Features file. * * @package Jetpack */ /** * Class WPCOM_Features. */ class WPCOM_Features { const ATOMIC = 'atomic'; const EMAIL_SUBSCRIPTION = 'email-subscription'; const MANAGE_PLUGINS = 'manage-plugins'; }
projects/plugins/jetpack/tests/php/lib/class-wp-test-jetpack-rest-testcase.php
<?php // This is WP_Test_REST_Controller_Testcase without the unneeded abstract methods. require_once __DIR__ . '/class-wp-test-spy-rest-server.php'; if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { require_once dirname( __DIR__, 3 ) . '/core/includes/testcase-rest-api.php'; } abstract class WP_Test_Jetpack_REST_Testcase...
projects/plugins/jetpack/tests/php/files/theme-file-sync-parent/parent-and-child.php
<!-- parent and child --> <?php // phpcs:ignoreFile
projects/plugins/jetpack/tests/php/files/theme-file-sync-parent/parent-only.php
<!-- parent only --> <?php // phpcs:ignoreFile
projects/plugins/jetpack/tests/php/files/theme-file-sync-child/parent-and-child.php
<!-- parent and child --> <?php // phpcs:ignoreFile
projects/plugins/jetpack/tests/php/files/theme-file-sync-child/child-only.php
<!-- child only --> <?php // phpcs:ignoreFile
projects/plugins/jetpack/tests/php/_inc/lib/test-class-jetpack-currencies.php
<?php /** * Currencies unit tests. * * @package automattic/jetpack */ require_once JETPACK__PLUGIN_DIR . '/_inc/lib/class-jetpack-currencies.php'; /** * Class for testing the Jetpack_Currencies class. */ class WP_Test_Jetpack_Currencies extends WP_UnitTestCase { /** * Test that USD currencies are formatted i...
projects/plugins/jetpack/tests/php/_inc/lib/test-class-jetpack-redux-state-helper.php
<?php /** * Redux State Helper unit tests. * * @package automattic/jetpack */ require_once JETPACK__PLUGIN_DIR . '_inc/lib/admin-pages/class-jetpack-redux-state-helper.php'; /** * Class for testing the Jetpack_Redux_State_Helper class. * * @coversDefaultClass Jetpack_Redux_State_Helper */ class WP_Test_Jetpac...
projects/plugins/jetpack/tests/php/_inc/lib/test_class.rest-api-authentication.php
<?php use Automattic\Jetpack\Connection\Rest_Authentication as Connection_Rest_Authentication; require_once JETPACK__PLUGIN_DIR . '/tests/php/lib/class-wp-test-jetpack-rest-testcase.php'; require_once JETPACK__PLUGIN_DIR . '/tests/php/lib/class-wp-test-spy-rest-server.php'; /** * Test class for Jetpack * * @cover...
projects/plugins/jetpack/tests/php/_inc/lib/test-class-jetpack-podcast-feed-locator.php
<?php /** * Podcast Feed Locator unit tests. * * @package automattic/jetpack */ require_once __DIR__ . '/mocks/class-simplepie-file.php'; require_once __DIR__ . '/mocks/class-simplepie-locator.php'; require_once JETPACK__PLUGIN_DIR . '/_inc/lib/class-jetpack-podcast-feed-locator.php'; /** * Class for testing the...
projects/plugins/jetpack/tests/php/_inc/lib/test-class-jetpack-podcast-helper.php
<?php /** * Podcast Helper unit tests. * * @package automattic/jetpack */ require_once JETPACK__PLUGIN_DIR . '/_inc/lib/class-jetpack-podcast-helper.php'; require_once __DIR__ . '/mocks/class-simplepie.php'; require_once __DIR__ . '/mocks/class-simplepie-item.php'; /** * Class for testing the Jetpack_Podcast_Hel...
projects/plugins/jetpack/tests/php/_inc/lib/test_class.rest-api-endpoints.php
<?php /** * Class for REST API endpoints testing. * * @since 4.4.0 * @package automattic/jetpack */ use Automattic\Jetpack\Connection\REST_Connector; use Automattic\Jetpack\Status\Cache as StatusCache; require_once __DIR__ . '/../../../../modules/widgets/milestone.php'; /** * phpcs:disable PEAR.NamingConventio...
projects/plugins/jetpack/tests/php/_inc/lib/test-class-jetpack-blogging-prompts.php
<?php /** * Blogging Prompts unit tests. * * @package automattic/jetpack */ require_once JETPACK__PLUGIN_DIR . '/_inc/blogging-prompts.php'; /** * Class for testing Jetpack Blogging Prompt functions. */ class WP_Test_Jetpack_Blogging_Prompts extends WP_UnitTestCase { public function test_adds_post_meta_and_tag...
projects/plugins/jetpack/tests/php/_inc/lib/test-class-jetpack-recommendations.php
<?php /** * Recommendations unit tests. * * @package automattic/jetpack */ require_once JETPACK__PLUGIN_DIR . '_inc/lib/class-jetpack-recommendations.php'; /** * Class for testing the Jetpack_Currencies class. */ class WP_Test_Jetpack_Recommendations extends WP_UnitTestCase { // The videopress recommendation ...
projects/plugins/jetpack/tests/php/_inc/lib/mocks/class-simplepie-item.php
<?php /** * Implements a basic interface of the SimplePie_Item class in environments where it doesn't exist. * * @package automattic/jetpack */ if ( ! class_exists( 'SimplePie_Item' ) ) { /** * Class SimplePie_Item. */ class SimplePie_Item { /** * Returns ID. * * @return int */ public functio...
projects/plugins/jetpack/tests/php/_inc/lib/mocks/class-simplepie.php
<?php /** * Implements a basic interface of the SimplePie class in environments where it doesn't exist. * * @package automattic/jetpack */ if ( ! class_exists( 'SimplePie' ) ) { /** * Class SimplePie */ class SimplePie { /** * Get a list or items. * * @return \SimplePie_Item[] */ public funct...
projects/plugins/jetpack/tests/php/_inc/lib/mocks/class-simplepie-locator.php
<?php /** * Implements a basic interface of the SimplePie_Locator class in environments where it doesn't exist. * * @package automattic/jetpack */ // phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable if ( ! class_exists( 'SimplePie_Locator' ) ) { /** * Class SimplePie_Locator */ cl...
projects/plugins/jetpack/tests/php/_inc/lib/mocks/class-simplepie-file.php
<?php /** * Implements a basic interface of the SimplePie_Locator class in environments where it doesn't exist. * * @package automattic/jetpack */ if ( ! class_exists( 'SimplePie_File' ) ) { /** * Class SimplePie_Locator */ class SimplePie_File { public $body; /** * Constructor * * Stores a res...
projects/plugins/jetpack/tests/php/_inc/lib/markdown/test-class-wpcom-ghf-markdown-parser.php
<?php /** * GitHub-Flavoured Markdown unit tests. * * @package Jetpack */ // Require the whole lib to process text. require_once JETPACK__PLUGIN_DIR . '_inc/lib/markdown.php'; /** * Class for testing the WPCom_GHF_Markdown_Parser class. * * @covers WPCom_GHF_Markdown_Parser */ class WP_Test_WPCom_GHF_Markdown...
projects/plugins/jetpack/tests/php/core-api/test_class.jetpack-core-api-module-endpoints.php
<?php require_once JETPACK__PLUGIN_DIR . '/tests/php/lib/class-wp-test-jetpack-rest-testcase.php'; require_once JETPACK__PLUGIN_DIR . '/tests/php/lib/class-wp-test-spy-rest-server.php'; class WP_Test_Jetpack_Core_Api_Module_Activate_Endpoint extends WP_Test_Jetpack_REST_Testcase { /** * @author zinigor * @covers...
projects/plugins/jetpack/tests/php/core-api/test_class.jetpack-core-api-xmlrpc-consumer-endpoint.php
<?php require_once JETPACK__PLUGIN_DIR . '/_inc/lib/core-api/class.jetpack-core-api-xmlrpc-consumer-endpoint.php'; class WP_Test_Jetpack_Core_Api_Xmlrpc_Consumer_Endpoint extends WP_UnitTestCase { /** * @author zinigor * @covers Jetpack_Core_API_XMLRPC_Consumer_Endpoint * @dataProvider true_false_provider */ ...
projects/plugins/jetpack/tests/php/core-api/test_class-wpcom-rest-field-controller.php
<?php class Example_WPCOM_REST_API_V2_Field_Controller extends WPCOM_REST_API_V2_Field_Controller { protected $object_type = 'example'; protected $field_name = 'example'; private $test_schema = array(); public function __construct( $test_schema ) { $this->test_schema = $test_schema; parent::__construct(); ...
projects/plugins/jetpack/tests/php/core-api/wpcom-fields/test-class.subscribers-endpoint.php
<?php require_once dirname( __DIR__, 2 ) . '/lib/class-wp-test-jetpack-rest-testcase.php'; if ( ( ! defined( 'IS_WPCOM' ) || ! IS_WPCOM ) && defined( 'JETPACK__PLUGIN_DIR' ) && JETPACK__PLUGIN_DIR ) { require_once JETPACK__PLUGIN_DIR . 'modules/subscriptions.php'; require_once JETPACK__PLUGIN_DIR . 'extensions/bloc...
projects/plugins/jetpack/tests/php/core-api/wpcom-fields/test-attachment-fields-videopress.php
<?php require_once dirname( __DIR__, 2 ) . '/lib/class-wp-test-jetpack-rest-testcase.php'; use Automattic\Jetpack\VideoPress\WPCOM_REST_API_V2_Attachment_VideoPress_Field; /** * Tests that Attachments do have VideoPress data in REST API * responses if the VideoPress Module is active. * * @group videopress * @gr...
projects/plugins/jetpack/tests/php/core-api/wpcom-fields/class-test-wpcom-rest-api-v2-attachment-videopress-data.php
<?php /** * Tests that Attachments do have VideoPress data in REST API * responses if the VideoPress Module is active. * * @package automattic/jetpack * * @group videopress * @group rest-api */ /** * The base testcase class. */ require_once dirname( __DIR__, 2 ) . '/lib/class-wp-test-jetpack-rest-testcase.ph...
projects/plugins/jetpack/tests/php/core-api/wpcom-fields/test-post-fields-publicize-connections.php
<?php require_once dirname( __DIR__, 2 ) . '/lib/class-wp-test-jetpack-rest-testcase.php'; /** * Tests that Posts and Custom Post Types do have Publicize data in REST API * responses if the Publicize Module is active. * * In this test environment, the Publicize Module is not active so this class * has hacks that...
projects/plugins/jetpack/tests/php/core-api/wpcom-fields/test-class.service-api-keys.php
<?php require_once dirname( __DIR__, 2 ) . '/lib/class-wp-test-jetpack-rest-testcase.php'; /** * @group publicize * @group rest-api */ class Test_WPCOM_REST_API_V2_Service_API_Keys_Endpoint extends WP_Test_Jetpack_REST_Testcase { public static $editor_user_id; public static $subscriber_user_id; public static f...
projects/plugins/jetpack/tests/php/core-api/wpcom-fields/test_post-fields-publicize-connections-inactive.php
<?php require_once JETPACK__PLUGIN_DIR . '/tests/php/lib/class-wp-test-jetpack-rest-testcase.php'; require_once JETPACK__PLUGIN_DIR . '/tests/php/lib/class-wp-test-spy-rest-server.php'; /** * Tests that Posts and Custom Post Types do not have Publicize data in REST API * responses if the Publicize Module is not act...
projects/plugins/jetpack/tests/php/core-api/wpcom-endpoints/test-class-wpcom-rest-api-v2-endpoint-external-media.php
<?php // phpcs:ignore /** * Tests for /wpcom/v2/external-media endpoints. */ use WpOrg\Requests\Requests; require_once dirname( __DIR__, 2 ) . '/lib/class-wp-test-jetpack-rest-testcase.php'; /** * Class WP_Test_WPCOM_REST_API_V2_Endpoint_External_Media * * @coversDefaultClass WPCOM_REST_API_V2_Endpoint_External...
projects/plugins/jetpack/tests/php/core-api/wpcom-endpoints/test-class-wpcom-rest-api-v2-endpoint-admin-menu.php
<?php // phpcs:ignore /** * Tests for /wpcom/v2/admin-menu endpoint. */ use WpOrg\Requests\Requests; require_once dirname( __DIR__, 2 ) . '/lib/class-wp-test-jetpack-rest-testcase.php'; /** * Class WP_Test_WPCOM_REST_API_V2_Endpoint_Admin_Menu * * @coversDefaultClass WPCOM_REST_API_V2_Endpoint_Admin_Menu */ cl...
projects/plugins/jetpack/tests/php/core-api/wpcom-endpoints/test-class-wpcom-rest-api-v2-endpoint-publicize-share-post.php
<?php // phpcs:ignore /** * Tests for WPCOM_REST_API_V2_Endpoint_Publicize_Share_Post. * To run this test by itself use the following command: * jetpack docker phpunit -- --filter=WP_Test_WPCOM_REST_API_V2_Endpoint_Publicize_Share_Post */ use WpOrg\Requests\Requests; require_once dirname( __DIR__, 2 ) . '/lib/cla...
projects/plugins/jetpack/tests/php/core-api/wpcom-endpoints/test-class-wpcom-rest-api-v2-endpoint-transient.php
<?php // phpcs:ignore /** * Tests for /wpcom/v2/transients endpoints. */ use WpOrg\Requests\Requests; require_once dirname( __DIR__, 2 ) . '/lib/class-wp-test-jetpack-rest-testcase.php'; /** * Class WP_Test_WPCOM_REST_API_V2_Endpoint_Transient * * @coversDefaultClass WPCOM_REST_API_V2_Endpoint_Transient */ cla...
projects/plugins/jetpack/tests/php/core-api/wpcom-endpoints/test-class-wpcom-rest-api-v2-endpoint-send-email-preview.php
<?php // phpcs:ignore /** * Tests for WPCOM_REST_API_V2_Endpoint_Send_Email_Preview. * To run this test by itself use the following command: * jetpack docker phpunit -- --filter=WP_Test_WPCOM_REST_API_V2_Endpoint_Send_Email_Preview */ use WpOrg\Requests\Requests; require_once dirname( __DIR__, 2 ) . '/lib/class-w...
projects/plugins/jetpack/tests/php/sync/test_interface.jetpack-sync-replicastore.php
<?php use Automattic\Jetpack\Sync\Replicastore; use Yoast\PHPUnitPolyfills\TestCases\TestCase; if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { require_once ABSPATH . 'wp-content/mu-plugins/jetpack/sync/class.jetpack-sync-test-object-factory.php'; } else { // is running in jetpack require_once __DIR__ . '/server/class.j...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-queue.php
<?php use Automattic\Jetpack\Sync\Queue; use Automattic\Jetpack\Sync\Queue_Buffer; class WP_Test_Jetpack_Sync_Queue extends WP_UnitTestCase { private $queue; /** * Set up. */ public function set_up() { parent::set_up(); $this->queue = new Queue( 'my_queue' ); } public function test_add_queue_items() ...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-import.php
<?php /** * Testing Import Syncing Events */ class WP_Test_Jetpack_Sync_Import extends WP_Test_Jetpack_Sync_Base { public function test_sync_export_content_event() { // Can't call export_wp directly since it require no headers to be set... do_action( 'export_wp', array( 'content' => 'all' ) ); $this->sender->...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-comments.php
<?php use Automattic\Jetpack\Sync\Modules; /** * Testing CRUD on Comments * * @group jetpack-sync */ class WP_Test_Jetpack_Sync_Comments extends WP_Test_Jetpack_Sync_Base { protected $comment; protected $post_id; protected $comment_ids; /** * Set up. */ public function set_up() { parent::set_up(); ...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-health.php
<?php use Automattic\Jetpack\Sync\Health; use Automattic\Jetpack\Sync\Settings; class WP_Test_Jetpack_Sync_Health extends WP_Test_Jetpack_Sync_Base { public function test_update_status_should_default_to_unknown() { // When an invalid status is used, we should default to an unknown status. Health::update_status( ...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-meta.php
<?php /** * Testing CRUD on Meta */ use Automattic\Jetpack\Forms\ContactForm\Contact_Form_Plugin; use Automattic\Jetpack\Sync\Defaults; use Automattic\Jetpack\Sync\Modules; use Automattic\Jetpack\Sync\Modules\Posts; use Automattic\Jetpack\Sync\Settings; class WP_Test_Jetpack_Sync_Meta extends WP_Test_Jetpack_Sync_B...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php
<?php use Automattic\Jetpack\Sync\Defaults; use Automattic\Jetpack\Sync\Modules; require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; // Mock object requiered for test_theme_update() class Dummy_Sync_Test_WP_Upgrader { public $skin; public $result = true; public function __construct() { $this->sk...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-constants.php
<?php use Automattic\Jetpack\Sync\Defaults; use Automattic\Jetpack\Sync\Modules; use Automattic\Jetpack\Sync\Modules\Constants; /** * Testing CRUD on Constants */ class WP_Test_Jetpack_Sync_Constants extends WP_Test_Jetpack_Sync_Base { protected $post_id; protected $constant_module; /** * Set up. */ public...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-listener.php
<?php use Automattic\Jetpack\IP\Utils as IP_Utils; use Automattic\Jetpack\Roles; use Automattic\Jetpack\Sync\Defaults; use Automattic\Jetpack\Sync\Health; use Automattic\Jetpack\Sync\Settings; class WP_Test_Jetpack_Sync_Listener extends WP_Test_Jetpack_Sync_Base { public function test_never_queues_if_development() {...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-modules-stats.php
<?php // phpcs:ignore WordPress.Files.Filename use Automattic\Jetpack\Heartbeat; /** * Test the sync stats module. */ class WP_Test_Jetpack_Sync_Module_Stats extends WP_Test_Jetpack_Sync_Base { const TEST_STAT_NAME = 'test_stat'; const TEST_STAT_VALUE = 'test_stat_value'; /** * Tests that stats data is sent...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-integration.php
<?php use Automattic\Jetpack\Constants; use Automattic\Jetpack\Sync\Actions; use Automattic\Jetpack\Sync\Modules; use Automattic\Jetpack\Sync\Settings; class WP_Test_Jetpack_Sync_Integration extends WP_Test_Jetpack_Sync_Base { public function test_sending_empties_queue() { self::factory()->post->create(); $this...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-sso.php
<?php /** * Testing sync of values for SSO. */ class WP_Test_Jetpack_Sync_SSO extends WP_Test_Jetpack_Sync_Base { /** * Set up. */ public function set_up() { parent::set_up(); $this->sender->do_sync(); $this->resetCallableAndConstantTimeouts(); } public function test_sync_sso_is_two_step_required_filt...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-updates.php
<?php use Automattic\Jetpack\Constants; use Automattic\Jetpack\Sync\Modules; /** * Testing Updates Sync */ class WP_Test_Jetpack_Sync_Updates extends WP_Test_Jetpack_Sync_Base { protected $post_id; /** * Set up. */ public function set_up() { parent::set_up(); $this->sender->reset_data(); wp_set_curren...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-terms.php
<?php use Automattic\Jetpack\Sync\Defaults; use Automattic\Jetpack\Sync\Modules; use Automattic\Jetpack\Sync\Settings; /** * Testing CRUD on Terms */ class WP_Test_Jetpack_Sync_Terms extends WP_Test_Jetpack_Sync_Base { protected $post_id; protected $term_object; protected $taxonomy; protected $terms_module; /...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-options.php
<?php use Automattic\Jetpack\Sync\Modules; use Automattic\Jetpack\Sync\Settings; /** * Testing CRUD on Options */ class WP_Test_Jetpack_Sync_Options extends WP_Test_Jetpack_Sync_Base { protected $post; protected $options_module; /** * Set up. */ public function set_up() { parent::set_up(); $this->opti...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-callables.php
<?php use Automattic\Jetpack\Blocks; use Automattic\Jetpack\Connection\Rest_Authentication as Connection_Rest_Authentication; use Automattic\Jetpack\Connection\Urls; use Automattic\Jetpack\Constants; use Automattic\Jetpack\Sync\Defaults; use Automattic\Jetpack\Sync\Functions; use Automattic\Jetpack\Sync\Modules; use A...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-lock.php
<?php /** * Tests for the Lock class. * * @package automattic/jetpack-sync */ use Automattic\Jetpack\Sync\Lock; /** * WP_Test_Jetpack_Sync_Lock class */ class WP_Test_Jetpack_Sync_Lock extends WP_Test_Jetpack_Sync_Base { /** * Test request lock twice */ public function test_request_lock_twice() { $this...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-queue-custom-table.php
<?php use Automattic\Jetpack\Sync\Queue; use Automattic\Jetpack\Sync\Queue\Queue_Storage_Table; use Automattic\Jetpack\Sync\Settings; require_once __DIR__ . '/class-wp-test-jetpack-sync-queue-base-tests.php'; /** * @group jetpack-sync * @group jetpack-sync-queue * @group jetpack-sync-queue-custom-table */ class ...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full-immediately.php
<?php use Automattic\Jetpack\Sync\Actions; use Automattic\Jetpack\Sync\Health; use Automattic\Jetpack\Sync\Modules; use Automattic\Jetpack\Sync\Modules\Full_Sync; use Automattic\Jetpack\Sync\Settings; // phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed if ( ! function_exists( 'jetpack_foo_full_sync_callab...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-modules.php
<?php /** * Testing Activation and Deactivation of Modules */ class WP_Test_Jetpack_Sync_Modules extends WP_Test_Jetpack_Sync_Base { public function test_sync_activate_module_event() { // Calling the activate_module in tests is difficult. // Since the site need to eather be connected or in offline mode. // B...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-settings.php
<?php use Automattic\Jetpack\Sync\Dedicated_Sender; use Automattic\Jetpack\Sync\Settings; class WP_Test_Jetpack_Sync_Settings extends WP_Test_Jetpack_Sync_Base { /** * Whether a dedicated Sync test request was spawned. * * @var bool */ protected $dedicated_sync_test_request_spawned; /** * Setting up th...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-plugins-updates.php
<?php use Automattic\Jetpack\Constants; require_once __DIR__ . '/test_class.jetpack-sync-plugins.php'; require_once __DIR__ . '/class.silent-upgrader-skin.php'; /** * Testing CRUD on Plugins */ class WP_Test_Jetpack_Sync_Plugins_Updates extends WP_Test_Jetpack_Sync_Base { /** * Set up. */ public function se...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack_sync_backward_compatibility.php
<?php /** * Testing Backward Compatibility with Olter plugins. */ class WP_Test_Jetpack_Sync_Backward_Compatibility extends WP_Test_Jetpack_Sync_Base { public function test_backwards_compatibility_sync_options() { require_once JETPACK__PLUGIN_DIR . '3rd-party/crowdsignal.php'; $this->setExpectedDeprecated( 'Je...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-full.php
<?php use Automattic\Jetpack\Sync\Actions; use Automattic\Jetpack\Sync\Modules; use Automattic\Jetpack\Sync\Modules\Full_Sync; use Automattic\Jetpack\Sync\Settings; /** * Testing Jetpack's full sync module prior to 8.2 release. * * @group legacy-full-sync */ class WP_Test_Jetpack_Sync_Full extends WP_Test_Jetpack...
projects/plugins/jetpack/tests/php/sync/test-class.jetpack-sync-checksum-smoke.php
<?php /** * Smoke Tests for Table Checksum functionality. * * @package automattic/jetpack-sync */ use Automattic\Jetpack\Sync\Replicastore\Table_Checksum; /** * Testing Table Checksum * * @group jetpack-sync */ class WP_Test_Jetpack_Sync_Checksum_Smoke extends WP_UnitTestCase { /** * Setup Test Data. */...
projects/plugins/jetpack/tests/php/sync/class-wp-test-jetpack-sync-queue-base-tests.php
<?php use Automattic\Jetpack\Sync\Queue; use Automattic\Jetpack\Sync\Queue_Buffer; /** * @group jetpack-sync * @group jetpack-sync-queue */ /** * This is abstract class to cover common test cases between testing the Options Table and Dedicated Table */ abstract class WP_Test_Jetpack_Sync_Queue_Base_Tests extend...
projects/plugins/jetpack/tests/php/sync/test_interface.jetpack-sync-codec.php
<?php use Yoast\PHPUnitPolyfills\TestCases\TestCase; /** * Tests all known implementations of the codec */ class WP_Test_Jetpack_Sync_Codec_Interface extends TestCase { public static $all_codecs; /** * @dataProvider codec_provider */ public function test_sync_codec_encodes_objects( $codec ) { $object = (...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-defaults.php
<?php use Automattic\Jetpack\Sync\Defaults; /** * Testing WP_Test_Defaults class */ class WP_Test_Jetpack_Sync_Defaults extends WP_Test_Jetpack_Sync_Base { private $jp_option = 'example_jp_option_name_here'; private $jp_sync_option = 'example_jp_sync_option_name_here'; /** * Set up. */ public function set...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-module-protect.php
<?php use Automattic\Jetpack\Constants; /** * Test pluggable functionality for bruteprotect */ class WP_Test_Jetpack_Sync_Module_Protect extends WP_Test_Jetpack_Sync_Base { public function test_sends_failed_login_message() { $user_id = self::factory()->user->create(); $user = get_userdata( $user_id ); do_...
projects/plugins/jetpack/tests/php/sync/test-class.jetpack-sync-checksum.php
<?php /** * Integration Tests for Table Checksum functionality. * * @package automattic/jetpack-sync */ use Automattic\Jetpack\Sync\Replicastore\Table_Checksum; use Automattic\Jetpack\Sync\Settings; /** * Testing Table Checksum. * * @group jetpack-sync */ class WP_Test_Jetpack_Sync_Checksum extends WP_UnitTes...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-posts.php
<?php use Automattic\Jetpack\Constants; use Automattic\Jetpack\Forms\ContactForm\Contact_Form_Plugin; use Automattic\Jetpack\Roles; use Automattic\Jetpack\Sync\Defaults; use Automattic\Jetpack\Sync\Modules; use Automattic\Jetpack\Sync\Settings; /** * Testing CRUD on Posts * * @group jetpack-sync */ class WP_Test_...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-queue-options-table.php
<?php use Automattic\Jetpack\Sync\Queue; require_once __DIR__ . '/class-wp-test-jetpack-sync-queue-base-tests.php'; /** * @group jetpack-sync * @group jetpack-sync-queue * @group jetpack-sync-queue-options */ class WP_Test_Jetpack_Sync_Queue_Options_Table extends WP_Test_Jetpack_Sync_Queue_Base_Tests { /** *...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-plugins.php
<?php /** * Testing CRUD on Plugins */ class WP_Test_Jetpack_Sync_Plugins extends WP_Test_Jetpack_Sync_Base { protected $theme; const PLUGIN_ZIP = __DIR__ . '/../files/the.1.1.zip'; public function test_installing_and_removing_plugin_is_synced() { $this->resetCallableAndConstantTimeouts(); $this->sender->do_s...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-wp_super_cache.php
<?php use Automattic\Jetpack\Sync\Modules; use Automattic\Jetpack\Sync\Modules\WP_Super_Cache; /** * Testing WP Super Cache Sync */ class WP_Test_Jetpack_Sync_WP_Super_Cache extends WP_Test_Jetpack_Sync_Base { public static $wp_super_cache_enabled; /** * Set up before class. */ public static function set_u...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-network-options.php
<?php use Automattic\Jetpack\Sync\Modules; /** * Testing CRUD on Network Options * use phpunit --testsuite sync --filter WP_Test_Jetpack_Sync_Network_Options */ class WP_Test_Jetpack_Sync_Network_Options extends WP_Test_Jetpack_Sync_Base { protected $post; protected $network_options_module; /** * Set up. *...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-term-relationships.php
<?php use Automattic\Jetpack\Sync\Modules; /** * Testing sync on Term Relationships * * @group legacy-full-sync */ class WP_Test_Jetpack_Sync_Term_Relationships extends WP_Test_Jetpack_Sync_Base { protected $post_id; protected $term_object; protected $taxonomy; protected $terms_module; protected $full_sync; ...
projects/plugins/jetpack/tests/php/sync/class.silent-upgrader-skin.php
<?php // phpcs:ignore WordPress.Files.FileName require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader-skin.php'; class Silent_Upgrader_Skin extends WP_Upgrader_Skin { /** * Can the theme be overwritten. * * @var bool|string */ public $overwrite; /** * Constructor * * @param array $args Options....
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-woocommerce.php
<?php use Automattic\Jetpack\Sync\Modules; require_once __DIR__ . '/../trait-woo-tests.php'; /** * Testing WooCommerce Sync * * @group woocommerce */ class WP_Test_Jetpack_Sync_WooCommerce extends WP_Test_Jetpack_Sync_Base { /** * Using the WooCommerceTestTrait to include WooCommerce related dependencies for ...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-actions.php
<?php use Automattic\Jetpack\Sync\Actions; use Automattic\Jetpack\Sync\Health; use Automattic\Jetpack\Sync\Lock; use Automattic\Jetpack\Sync\Modules; use Automattic\Jetpack\Sync\Settings; class WP_Test_Jetpack_Sync_Actions extends WP_UnitTestCase { public function test_get_sync_status() { $no_checksum = Actions::g...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-base.php
<?php use Automattic\Jetpack\Sync\Data_Settings; use Automattic\Jetpack\Sync\Listener; use Automattic\Jetpack\Sync\Modules; use Automattic\Jetpack\Sync\Modules\Callables; use Automattic\Jetpack\Sync\Modules\Constants; use Automattic\Jetpack\Sync\Modules\Posts; use Automattic\Jetpack\Sync\Replicastore; use Automattic\J...
projects/plugins/jetpack/tests/php/sync/class-test-jetpack-sync-search.php
<?php /** * Integration Tests for Search syncing. * * @package automattic/jetpack-sync */ use Automattic\Jetpack\Sync\Modules; use Automattic\Jetpack\Sync\Settings; /** * Testing Search Sync modifications. * * @group jetpack-sync */ class Test_Jetpack_Sync_Search extends WP_Test_Jetpack_Sync_Base { /** * ...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-sender.php
<?php use Automattic\Jetpack\Constants; use Automattic\Jetpack\Sync\Dedicated_Sender; use Automattic\Jetpack\Sync\Defaults; use Automattic\Jetpack\Sync\Lock; use Automattic\Jetpack\Sync\Modules; use Automattic\Jetpack\Sync\Modules\Callables; use Automattic\Jetpack\Sync\Settings; class WP_Test_Jetpack_Sync_Sender exte...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-menus.php
<?php /** * Testing CRUD on Options */ class WP_Test_Jetpack_Sync_Menus extends WP_Test_Jetpack_Sync_Base { public function test_sync_creating_a_menu() { $menu_id = wp_create_nav_menu( 'FUN' ); $this->sender->do_sync(); $event = $this->server_event_storage->get_most_recent_event( 'wp_create_nav_menu' ); $...
projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-users.php
<?php use Automattic\Jetpack\Constants; use Automattic\Jetpack\Sync\Modules; use Automattic\Jetpack\Sync\Users; /** * Testing CRUD on Users */ class WP_Test_Jetpack_Sync_Users extends WP_Test_Jetpack_Sync_Base { protected $user_id; /** * Set up. */ public function set_up() { parent::set_up(); // create...
projects/plugins/jetpack/tests/php/sync/server/class.jetpack-sync-test-helper.php
<?php // phpcs:ignore WordPress.Files.FileName /** * Class Jetpack_Sync_Test_Helper * * Provides utilities and hooks needed for testing */ class Jetpack_Sync_Test_Helper { public $array_override; public function filter_override_array() { return $this->array_override; } }
projects/plugins/jetpack/tests/php/sync/server/class.jetpack-sync-server-eventstore.php
<?php // phpcs:ignore WordPress.Files.FileName /** * Just stores a buffer of received events */ class Jetpack_Sync_Server_Eventstore { private $events = array(); private $action_name = null; public function init() { add_action( 'jetpack_sync_remote_action', array( $this, 'handle_remote_action' ), 10, 9 );...
projects/plugins/jetpack/tests/php/sync/server/class.jetpack-sync-test-object-factory.php
<?php // phpcs:ignore WordPress.Files.FileName // special factory that creates transient versions of various WP objects class JetpackSyncTestObjectFactory { public static $default_post_props = array( 'post_title' => 'The Title', 'post_content' => 'The Content', 'post_name' => 'th...
projects/plugins/jetpack/tests/php/sync/server/class.jetpack-sync-test-replicastore.php
<?php // phpcs:ignore WordPress.Files.FileName use Automattic\Jetpack\Sync\Defaults; use Automattic\Jetpack\Sync\Replicastore_Interface; /** * A simple in-memory implementation of iJetpack_Sync_Replicastore * used for development and testing */ class Jetpack_Sync_Test_Replicastore implements Replicastore_Interface...
projects/plugins/jetpack/tests/php/sync/server/class.jetpack-sync-server-replicator.php
<?php // phpcs:ignore WordPress.Files.FileName use Automattic\Jetpack\Sync\Replicastore_Interface; /** * Translates incoming actions from the Jetpack site into mutations on core types * In other words: this tries to keep a local datastore in sync with the remote one */ class Jetpack_Sync_Server_Replicator { priva...
projects/plugins/jetpack/tests/php/modules/infinite-scroll/test_class.infinite-scroll.php
<?php require __DIR__ . '/../../../../modules/infinite-scroll/infinity.php'; /** * Tests for The_Neverending_Home_Page. * * @covers The_Neverending_Home_Page */ class WP_Test_The_Neverending_Home_Page extends WP_UnitTestCase { private $infinite_scroll; /** * Set up. */ public function set_up() { parent:...
projects/plugins/jetpack/tests/php/modules/csstidy/test-class.jetpack-csstidy.php
<?php /** * Class WP_Test_Jetpack_CSSTidy. * * @package automattic/jetpack */ require_once JETPACK__PLUGIN_DIR . 'modules/custom-css/csstidy/class.csstidy.php'; /** * Class WP_Test_Jetpack_CSSTidy */ class WP_Test_Jetpack_CSSTidy extends WP_UnitTestCase { /** * The tested instance. * * @var csstidy */...
projects/plugins/jetpack/tests/php/modules/videopress/test_class.videopress-player.php
<?php /** * VideoPress Player tests. * * @package automattic/jetpack */ require_once JETPACK__PLUGIN_DIR . 'modules/videopress/class.videopress-player.php'; require_once JETPACK__PLUGIN_DIR . 'modules/videopress/class.videopress-video.php'; /** * Tests Jetpack VideoPress Player * * To run: jetpack docker phpun...
projects/plugins/jetpack/tests/php/modules/videopress/test_functions.utility-functions.php
<?php /** * Class WP_Test_Jetpack_VideoPress_Utility_Functions * * Note that modules/videopress/utility-functions.php is automatically loaded and does not need to be required in this file. * * @package automattic/jetpack */ /** * Tests Jetpack_VideoPress_Utility_Functions */ class WP_Test_Jetpack_VideoPress_Ut...
projects/plugins/jetpack/tests/php/modules/geo-location/test_class.jetpack-geo-location.php
<?php require_once JETPACK__PLUGIN_DIR . '/modules/geo-location/class.jetpack-geo-location.php'; class WP_Test_Jetpack_Geo_Location extends WP_UnitTestCase { const DISABLE_CONSTRUCTOR = true; const ENABLE_CONSTRUCTOR = false; const MOCK_LAT = '41.878114'; const MOCK_LONG = '-87.629798'; const MOCK_ADDRESS =...
projects/plugins/jetpack/tests/php/modules/google-analytics/test-class.google-analytics.php
<?php /** * Tests for the Google Analytics module. * * @package automattic/jetpack */ require_once JETPACK__PLUGIN_DIR . 'modules/google-analytics/wp-google-analytics.php'; /** * Class WP_Test_Jetpack_Google_Analytics. */ class WP_Test_Jetpack_Google_Analytics extends WP_UnitTestCase { /** * Testing Google ...
projects/plugins/jetpack/tests/php/modules/google-analytics/test-class.jetpack-google-amp-analytics.php
<?php /** * Tests for the WooCommerce Google Analytics. * * @package automattic/jetpack */ require_once __DIR__ . '/../../trait-woo-tests.php'; /** * Class WP_Test_Jetpack_Google_AMP_Analytics */ class WP_Test_Jetpack_Google_AMP_Analytics extends WP_UnitTestCase { /** * Using the WooCommerceTestTrait to includ...
projects/plugins/jetpack/tests/php/modules/wpcom-block-editor/test_class-jetpack-wpcom-block-editor.php
<?php require_once JETPACK__PLUGIN_DIR . 'modules/wpcom-block-editor/class-jetpack-wpcom-block-editor.php'; /** * Class WP_Test_Jetpack_WPCOM_Block_Editor. * * @covers Jetpack_WPCOM_Block_Editor */ class WP_Test_Jetpack_WPCOM_Block_Editor extends WP_UnitTestCase { /** * User ID. * * @var int */ public $...
projects/plugins/jetpack/tests/php/modules/masterbar/test-class-posts-list-page-notification.php
<?php /** * Tests for Posts_List_Page_Notification class. * * @package automattic/jetpack */ use Automattic\Jetpack\Dashboard_Customizations\Posts_List_Page_Notification; require_once JETPACK__PLUGIN_DIR . 'modules/masterbar/wp-posts-list/class-posts-list-page-notification.php'; /** * Class Test_Posts_List_Page...
projects/plugins/jetpack/tests/php/modules/masterbar/test-class-wpcom-user-profile-fields-revert.php
<?php /** * Tests for WPCOM_User_Profile_Fields_Revert class. * * @package automattic/jetpack */ use Automattic\Jetpack\Connection\Manager as Connection_Manager; use Automattic\Jetpack\Dashboard_Customizations\WPCOM_User_Profile_Fields_Revert; require_once JETPACK__PLUGIN_DIR . 'modules/masterbar/profile-edit/cla...
projects/plugins/jetpack/tests/php/modules/masterbar/test-class-wpcom-admin-menu.php
<?php /** * Tests for WPcom_Admin_Menu class. * * @package automattic/jetpack */ use Automattic\Jetpack\Dashboard_Customizations\WPcom_Admin_Menu; use Automattic\Jetpack\Status; require_once JETPACK__PLUGIN_DIR . 'modules/masterbar/admin-menu/class-wpcom-admin-menu.php'; require_once JETPACK__PLUGIN_DIR . 'tests/...
projects/plugins/jetpack/tests/php/modules/masterbar/test-class-jetpack-admin-menu.php
<?php /** * Tests for Jetpack_Admin_Menu class. * * @package automattic/jetpack */ use Automattic\Jetpack\Dashboard_Customizations\Jetpack_Admin_Menu; use Automattic\Jetpack\Status; require_once JETPACK__PLUGIN_DIR . 'modules/masterbar/admin-menu/class-jetpack-admin-menu.php'; require_once JETPACK__PLUGIN_DIR . '...
projects/plugins/jetpack/tests/php/modules/masterbar/test-class-wpcom-additional-css-manager.php
<?php /** * Test_WPCOM_Additional_Css_Manager file. * Test WPCOM_Additional_CSS_Manager. * * @package Jetpack */ namespace Automattic\Jetpack\Dashboard_Customizations; require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; require_once ABSPATH . WPINC . '/class-wp-customize-control.php'; require_once ...
projects/plugins/jetpack/tests/php/modules/masterbar/test-class-css-customizer-nudge.php
<?php /** * Test_WPCOM_CSS_Customizer_Nudge file. * Test WPCOM_CSS_Customizer_Nudge. * * @package Jetpack */ namespace Automattic\Jetpack\Dashboard_Customizations; require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; require_once ABSPATH . WPINC . '/class-wp-customize-control.php'; require_once ABSP...
projects/plugins/jetpack/tests/php/modules/masterbar/test-class-admin-color-schemes.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Tests for Admin_Color_Schemes class. * * @package automattic/jetpack */ use Automattic\Jetpack\Dashboard_Customizations\Admin_Color_Schemes; use WpOrg\Requests\Requests; require_once JETPACK__PLUGIN_DIR . 'tests/php/lib/class-wp-test-jetpac...