filename
stringlengths
11
137
content
stringlengths
6
292k
projects/packages/analyzer/src/Differences/class-class-method-moved.php
<?php /** * Class Method Moved checker. * * @package automattic/jetpack-analyzer */ namespace Automattic\Jetpack\Analyzer\Differences; use Automattic\Jetpack\Analyzer\Warnings\Warning; // TODO - subclasses? /** * Class Class_Method_Moved */ class Class_Method_Moved extends Differences_List_Item implements Invo...
projects/packages/analyzer/src/Differences/class-class-const-moved.php
<?php /** * Class_Const_Moved. * * @package automattic/jetpack-analyzer */ namespace Automattic\Jetpack\Analyzer\Differences; use Automattic\Jetpack\Analyzer\Invocations\Static_Const; use Automattic\Jetpack\Analyzer\Warnings\Warning; // TODO - subclasses? /** * Class Class_Const_Moved */ class Class_Const_Move...
projects/packages/analyzer/src/Differences/class-invocation-warner.php
<?php /** * Invocation Warning interface * * @package automattic/jetpack-analyzer */ namespace Automattic\Jetpack\Analyzer\Differences; interface Invocation_Warner { /** * Find warnings. * * @param object $invocation Invocation. * @param object $warnings Warnings. */ public function find_invocation_wa...
projects/packages/analyzer/src/Differences/class-class-method-deprecated.php
<?php /** * Class Method Deprecated checker. * * @package automattic/jetpack-analyzer */ namespace Automattic\Jetpack\Analyzer\Differences; use Automattic\Jetpack\Analyzer\Warnings\Warning; // TODO - subclasses? /** * Class Class_Method_Deprecated */ class Class_Method_Deprecated extends Differences_List_Item ...
projects/packages/analyzer/src/Differences/class-class-missing.php
<?php /** * Class missing checker. * * @package automattic/jetpack-analyzer */ namespace Automattic\Jetpack\Analyzer\Differences; use Automattic\Jetpack\Analyzer\Invocations\New_; use Automattic\Jetpack\Analyzer\Warnings\Warning; // TODO - subclasses? /** * Class Class_Missing */ class Class_Missing extends Di...
projects/packages/analyzer/src/Differences/class-class-moved.php
<?php /** * Class_Moved. * * @package automattic/jetpack-analyzer */ namespace Automattic\Jetpack\Analyzer\Differences; use Automattic\Jetpack\Analyzer\Warnings\Warning; // TODO - subclasses? /** * Class Class_Moved. */ class Class_Moved extends Differences_List_Item implements Invocation_Warner { /** * Old...
projects/packages/analyzer/src/Differences/class-function-moved.php
<?php /** * Function Moved Checker. * * @package automattic/jetpack-analyzer */ namespace Automattic\Jetpack\Analyzer\Differences; use Automattic\Jetpack\Analyzer\Warnings\Warning; // TODO - subclasses? /** * Class Function_Moved */ class Function_Moved extends Differences_List_Item implements Invocation_Warne...
projects/packages/analyzer/src/Differences/class-differences-list-item.php
<?php /** * Abstract class that provides serialize API for `Differences` classes * * @package automattic/jetpack-analyzer */ namespace Automattic\Jetpack\Analyzer\Differences; use Automattic\Jetpack\Analyzer\PersistentList\Item as PersistentListItem; /** * Class Differences_List_Item */ abstract class Differen...
projects/packages/analyzer/src/Differences/class-function-deprecated.php
<?php /** * Function Deprecated Checker. * * @package automattic/jetpack-analyzer */ namespace Automattic\Jetpack\Analyzer\Differences; use Automattic\Jetpack\Analyzer\Warnings\Warning; // TODO - subclasses? /** * Class Function_Deprecated */ class Function_Deprecated extends Differences_List_Item implements I...
projects/packages/analyzer/src/Warnings/class-warning.php
<?php /** * Warnings processing of Persistent List items. * * @package automattic/jetpack-analyzer */ namespace Automattic\Jetpack\Analyzer\Warnings; use Automattic\Jetpack\Analyzer\PersistentList\Item as PersistentListItem; /** * Class Warning */ class Warning extends PersistentListItem { /** * Type. * ...
projects/packages/image-cdn/tests/php/test_class.image_cdn_core.php
<?php use Automattic\Jetpack\Image_CDN\Image_CDN_Core; use WorDBless\BaseTestCase; class WP_Test_Image_CDN_Core extends BaseTestCase { private $custom_photon_domain; /** * Tear down. */ public function tear_down() { remove_filter( 'jetpack_photon_domain', array( $this, 'apply_custom_domain' ) ); unset( $...
projects/packages/image-cdn/tests/php/test_class.image_cdn.php
<?php use Automattic\Jetpack\Image_CDN\Image_CDN; if ( ! defined( 'WP_TESTS_DOMAIN' ) ) { define( 'WP_TESTS_DOMAIN', 'example.org' ); } class WP_Test_Image_CDN extends Image_CDN_Attachment_Test_Case { /** * Test image. * * @var string */ protected static $test_image; /** * Save the existing globals. ...
projects/packages/image-cdn/tests/php/test_activitypub_compat.php
<?php /** * This file contains PHPUnit tests for the Activitypub compatibility functions. * To run the package unit tests, run jetpack test packages/image-cdn * * @package automattic/jetpack-image-cdn */ use WorDBless\BaseTestCase; require __DIR__ . '/../../src/compatibility/activitypub.php'; class Test_Activit...
projects/packages/image-cdn/tests/php/bootstrap.php
<?php /** * Bootstrap. * * @package automattic/ */ /** * Include the composer autoloader. */ require_once __DIR__ . '/../../vendor/autoload.php'; /** * Load WorDBless */ \WorDBless\Load::load(); /** * Load helper base class */ require_once __DIR__ . '/class-image-cdn-attachment-test-case.php';
projects/packages/image-cdn/tests/php/class-image-cdn-attachment-test-case.php
<?php use WorDBless\BaseTestCase; /** * Class with methods common to tests involving attachments. */ class Image_CDN_Attachment_Test_Case extends BaseTestCase { public function set_up() { parent::set_up(); if ( ! defined( 'DIR_TESTDATA' ) ) { define( 'DIR_TESTDATA', __DIR__ . '/sample-content' ); } /...
projects/packages/image-cdn/src/class-image-cdn-image-sizes.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * The Image Sizes library. * * @package automattic/jetpack-image-cdn */ namespace Automattic\Jetpack\Image_CDN; /** * Class Image_CDN_Image_Sizes * * Manages image resizing via Jetpack CDN Service. */ class Image_CDN_Image_Sizes { /** ...
projects/packages/image-cdn/src/class-image-cdn.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Class for photon functionality. * * @package automattic/jetpack-image-cdn */ namespace Automattic\Jetpack\Image_CDN; use Automattic\Jetpack\Assets; /** * Class Image_CDN */ final class Image_CDN { const PACKAGE_VERSION = '0.3.2'; /**...
projects/packages/image-cdn/src/class-image-cdn-image.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * The Image Class. * * @package automattic/jetpack-image-cdn */ namespace Automattic\Jetpack\Image_CDN; /** * Represents a resizable image, exposing properties necessary for properly generating srcset. */ class Image_CDN_Image { /** * A...
projects/packages/image-cdn/src/class-image-cdn-setup.php
<?php /** * Package description here * * @package automattic/jetpack-image-cdn */ namespace Automattic\Jetpack\Image_CDN; /** * Class description. */ class Image_CDN_Setup { /** * Initialize Image CDN. */ public static function load() { \Automattic\Jetpack\Assets::add_resource_hint( array( '//i0...
projects/packages/image-cdn/src/class-image-cdn-core.php
<?php /** * Core Image CDN functionality. * * It should be available even if Image CDN is not active. * * @package automattic/jetpack-image-cdn */ namespace Automattic\Jetpack\Image_CDN; use Automattic\Jetpack\Status; /** * A static class that provides core Image CDN functionality. */ class Image_CDN_Core { ...
projects/packages/image-cdn/src/compatibility/activitypub.php
<?php /** * Compatibility functions for the ActivityPub plugin. * * @since 0.2.2 * * @package automattic/jetpack-image-cdn */ namespace Automattic\Jetpack\Image_CDN\Compatibility; use Automattic\Jetpack\Image_CDN\Image_CDN; /** * Hook the compatibility functions into ActivityPub filters if necessary. * * @s...
projects/packages/image-cdn/src/compatibility/photon.php
<?php /** * Compatibility for Photon * * Replace photon with image-cdn. * * @package automattic/jetpack-image-cdn */ namespace Automattic\Jetpack\Image_CDN\Compatibility; /** * Disable the unpackaged photon version living in Jetpack. * * Before the package, Jetpack had the photon functionality within the plu...
projects/packages/stats/tests/php/test-options.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Tests Options class. * * @package jetpack-stats */ namespace Automattic\Jetpack\Stats; /** * Class to test the Options class. * * @covers \Automattic\Jetpack\Stats\Options */ class Test_Options extends StatsBaseTestCase { /** * Clean...
projects/packages/stats/tests/php/test-main.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Tests Main class. * * @package jetpack-stats */ namespace Automattic\Jetpack\Stats; use Automattic\Jetpack\Constants; use Automattic\Jetpack\Stats\Main as Stats; use Jetpack_Options; /** * Class to test the Main class. * * @covers Autom...
projects/packages/stats/tests/php/bootstrap.php
<?php /** * Bootstrap. * * @package automattic/ */ /** * Include the composer autoloader. */ require_once __DIR__ . '/../../vendor/autoload.php'; define( 'WP_DEBUG', true ); \WorDBless\Load::load();
projects/packages/stats/tests/php/test-tracking-pixel.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Tests Tracking Pixel class. * * @package jetpack-stats */ namespace Automattic\Jetpack\Stats; use WP_Query; /** * Class to test the Tracking_Pixel class. * * @covers \Automattic\Jetpack\Stats\Tracking_Pixel */ class Test_Tracking_Pixel...
projects/packages/stats/tests/php/test-xmlrpc-provider.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Tests XMLRPC_Provider class. * * @package jetpack-stats */ namespace Automattic\Jetpack\Stats; use Jetpack_Options; /** * Class to test the XMLRPC_Provider class. * * @covers Automattic\Jetpack\Stats\XMLRPC_Provider */ class Test_XMLRP...
projects/packages/stats/tests/php/test-wpcom-stats.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Tests WPCOM_Stats class. * * @package jetpack-stats */ namespace Automattic\Jetpack\Stats; use WP_Error; /** * Class to test the WPCOM_Stats class. * * @covers Automattic\Jetpack\Stats\WPCOM_Stats */ class Test_WPCOM_Stats extends Stat...
projects/packages/stats/tests/php/test-base.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * Base class for Stats package testing. * * @package jetpack-stats */ namespace Automattic\Jetpack\Stats; use Automattic\Jetpack\Constants; use Jetpack_Options; use WorDBless\BaseTestCase; use WorDBless\Options as WorDBless_Options; use WorDB...
projects/packages/stats/src/class-main.php
<?php /** * Stats Main * * @package automattic/jetpack-stats */ namespace Automattic\Jetpack\Stats; use Automattic\Jetpack\Connection\Manager as Connection_Manager; use Automattic\Jetpack\Constants; use Automattic\Jetpack\Modules; use Automattic\Jetpack\Status; use Automattic\Jetpack\Status\Visitor; use WP_User; ...
projects/packages/stats/src/class-tracking-pixel.php
<?php /** * Stats Tracking_Pixel * * @package automattic/jetpack-stats */ namespace Automattic\Jetpack\Stats; use Jetpack_Options; use WP_Post; /** * Stats Tracking_Pixel class. * * Responsible for embedding the Stats tracking pixel. * * @since 0.1.0 */ class Tracking_Pixel { /** * Array name. * * ...
projects/packages/stats/src/class-options.php
<?php /** * Stats Options * * @package automattic/jetpack-stats */ namespace Automattic\Jetpack\Stats; use Jetpack_Options; /** * Stats Options class. */ class Options { /** * Option name. * * @var string $option_name The 'stats' option name */ const OPTION_NAME = 'stats_options'; /** * Stats Op...
projects/packages/stats/src/class-xmlrpc-provider.php
<?php /** * The Stats XMLRPC Provider class * * @package automattic/jetpack-stats */ namespace Automattic\Jetpack\Stats; use Automattic\Jetpack\Connection\Manager as Connection_Manager; use Automattic\Jetpack\Modules; /** * Stats XMLRPC Provider. * * Adds additional methods to the WordPress XML-RPC API for ha...
projects/packages/stats/src/class-wpcom-stats.php
<?php /** * Stats WPCOM_Stats * * @package automattic/jetpack-stats */ namespace Automattic\Jetpack\Stats; use Automattic\Jetpack\Connection\Client; use Jetpack_Options; use WP_Error; /** * Stats WPCOM_Stats class. * * Responsible for fetching Stats related data from WPCOM. * * @link https://developer.wordp...
projects/packages/stats-admin/tests/php/test-stats-notices.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName namespace Automattic\Jetpack\Stats_Admin; use Automattic\Jetpack\Stats\Options as Stats_Options; use Automattic\Jetpack\Stats_Admin\Test_Case as Stats_Test_Case; /** * Unit tests for the Notice class. * * @package automattic/jetpack-stats-admin ...
projects/packages/stats-admin/tests/php/class-test-case.php
<?php /** * Test_Case class * * @package automattic/jetpack-stats-admin */ namespace Automattic\Jetpack\Stats_Admin; use PHPUnit\Framework\TestCase; use WorDBless\Options as WorDBless_Options; use WorDBless\Posts as WorDBless_Posts; use WorDBless\Users as WorDBless_Users; /** * Base Test_Case class which interc...
projects/packages/stats-admin/tests/php/test-stats-dashboard.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName: This is necessary to ensure that PHPUnit runs these tests. namespace Automattic\Jetpack\Stats_Admin; use Automattic\Jetpack\Stats_Admin\Test_Case as Stats_Test_Case; /** * Unit tests for the Dashbaord class. * * @package automattic/jetpack-stats-...
projects/packages/stats-admin/tests/php/test-odyssey-assets.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName: This is necessary to ensure that PHPUnit runs these tests. namespace Automattic\Jetpack\Stats_Admin; use Automattic\Jetpack\Stats_Admin\Test_Case as Stats_Test_Case; /** * Unit tests for the Odyssey_Assets class. * * @package automattic/jetpack-s...
projects/packages/stats-admin/tests/php/bootstrap.php
<?php /** * Initialize the testing environment. * * @package automattic/jetpack-stats */ /** * Load the composer autoloader. */ require_once __DIR__ . '/../../vendor/autoload.php'; require_once __DIR__ . '/class-test-case.php'; use Automattic\Jetpack\Constants; define( 'WP_DEBUG', true ); // The constant is n...
projects/packages/stats-admin/tests/php/test-odyssey-config-data.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName: This is necessary to ensure that PHPUnit runs these tests. namespace Automattic\Jetpack\Stats_Admin; use Automattic\Jetpack\Stats_Admin\Test_Case as Stats_Test_Case; /** * Unit tests for the Odyssey_Config_Data class. * * @package automattic/jetp...
projects/packages/stats-admin/tests/php/test-rest-controller.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName namespace Automattic\Jetpack\Stats_Admin; use Automattic\Jetpack\Stats_Admin\Test_Case as Stats_Test_Case; use WP_REST_Request; use WP_REST_Server; /** * Unit tests for the REST_Controller class. * * @package automattic/jetpack-stats-admin */ cl...
projects/packages/stats-admin/src/class-dashboard.php
<?php /** * A class that adds a stats dashboard to wp-admin. * * @package automattic/jetpack-stats-admin */ namespace Automattic\Jetpack\Stats_Admin; use Automattic\Jetpack\Admin_UI\Admin_Menu; use Automattic\Jetpack\Stats\Options as Stats_Options; /** * Responsible for adding a stats dashboard to wp-admin. * ...
projects/packages/stats-admin/src/class-wp-dashboard-odyssey-widget.php
<?php /** * A class that adds Jetpack Stats widget for WP Dashboard. * * @package automattic/jetpack-stats-admin */ namespace Automattic\Jetpack\Stats_Admin; /** * Responsible for loading Jetpack Stats widget for WP Dashboard. * * @package jetpack-stats-admin */ class WP_Dashboard_Odyssey_Widget { const DASH...
projects/packages/stats-admin/src/class-main.php
<?php /** * Stats Main * * @package automattic/jetpack-stats-admin */ namespace Automattic\Jetpack\Stats_Admin; use Automattic\Jetpack\Connection\Manager; use Automattic\Jetpack\Stats\Options as Stats_Options; use Automattic\Jetpack\Tracking; /** * Stats Main class. * * Entrypoint for Stats. * * @since 0.1....
projects/packages/stats-admin/src/class-notices.php
<?php /** * A class that handles the notices for the Stats Admin dashboard. * * @package automattic/jetpack-stats-admin */ namespace Automattic\Jetpack\Stats_Admin; use Automattic\Jetpack\Stats\Options as Stats_Options; use Jetpack_Options; /** * The Notices class handles the notices for the Stats Admin dashboa...
projects/packages/stats-admin/src/class-odyssey-config-data.php
<?php /** * Stats Initial State * * @package automattic/jetpack-stats-admin */ namespace Automattic\Jetpack\Stats_Admin; use Automattic\Jetpack\Current_Plan as Jetpack_Plan; use Automattic\Jetpack\Modules; use Automattic\Jetpack\Status\Host; use Jetpack_Options; /** * Class Odyssey_Config_Data * * @package au...
projects/packages/stats-admin/src/class-odyssey-assets.php
<?php /** * Stats Assets * * @package automattic/jetpack-stats-admin */ namespace Automattic\Jetpack\Stats_Admin; use Automattic\Jetpack\Assets; /** * Class Odyssey_Config_Data * * @package automattic/jetpack-stats-admin */ class Odyssey_Assets { // This is a fixed list @see https://github.com/Automattic/wp...
projects/packages/stats-admin/src/class-rest-controller.php
<?php /** * The Stats Rest Controller class. * Registers the REST routes for Odyssey Stats. * * @package automattic/jetpack-stats-admin */ namespace Automattic\Jetpack\Stats_Admin; use Automattic\Jetpack\Constants; use Automattic\Jetpack\Stats\WPCOM_Stats; use Jetpack_Options; use WP_Error; use WP_REST_Server; ...
projects/packages/stats-admin/src/class-wpcom-client.php
<?php /** * A class that wraps `Automattic\Jetpack\Connection\Client` and handles cache and errors. * * @package automattic/jetpack-stats-admin */ namespace Automattic\Jetpack\Stats_Admin; use Automattic\Jetpack\Connection\Client; use WP_Error; /** * A class that wraps `Automattic\Jetpack\Connection\Client` and...
projects/packages/lazy-images/tests/php/bootstrap.php
<?php /** * PHPUnit bootstrap file. * * @package automattic/jetpack-lazy-images */ define( 'IS_JETPACK_LAZY_IMAGES_TESTS', true ); // flag for hack /** * Load the composer autoloader. */ require_once __DIR__ . '/../../vendor/autoload.php'; /** * Load WorDBless */ \WorDBless\Load::load();
projects/packages/lazy-images/tests/php/test_class.lazy-images.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName require __DIR__ . '/../../src/lazy-images.php'; use Automattic\Jetpack\Constants; use Automattic\Jetpack\Jetpack_Lazy_Images; use WorDBless\BaseTestCase; /** * Class WP_Test_Lazy_Images */ class WP_Test_Lazy_Images extends BaseTestCase { use \Yoa...
projects/packages/lazy-images/src/lazy-images.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName /** * The Lazy Images package. * * @since 1.0.0 * @since-jetpack 8.8.0 * * This package has been lifted from the Jetpack modules folder and adapted to be * an standalone package reusable outside Jetpack. * * @package automattic/jetpack-lazy-i...
projects/packages/autoloader/tests/php/bootstrap.php
<?php /** * Bootstrap file for the autoloader test suite. * * @package automattic/jetpack-autoloader */ // Note: Make sure to normalize the path constants so that the test environment is the same on both Windows. define( 'TEST_DIR', str_replace( '\\', '/', __DIR__ ) ); // Make sure its easy to reference the test ...
projects/packages/autoloader/tests/php/tests/unit/AutoloadProcessorTest.php
<?php /** * Autoloader test suite. * * @package automattic/jetpack-autoloader */ use Automattic\Jetpack\Autoloader\AutoloadProcessor; use PHPUnit\Framework\TestCase; /** * Test suite class for the Autoload processor. */ class AutoloadProcessorTest extends TestCase { /** * Tests that all of the process funct...
projects/packages/autoloader/tests/php/tests/unit/ManifestReaderTest.php
<?php /** * File loader test suite. * * @package automattic/jetpack-autoloader */ // We live in the namespace of the test autoloader to avoid many use statements. namespace Automattic\Jetpack\Autoloader\jpCurrent; use Classmap_Test_Class; use PHPUnit\Framework\TestCase; use Test_Plugin_Factory; /** * Test suite...
projects/packages/autoloader/tests/php/tests/unit/VersionSelectorTest.php
<?php /** * The VersionSelectorTest class file. * * @package automattic/jetpack-autoloader */ // We live in the namespace of the test autoloader to avoid many use statements. namespace Automattic\Jetpack\Autoloader\jpCurrent; use PHPUnit\Framework\TestCase; /** * Provides unit tests for the methods in the Versi...
projects/packages/autoloader/tests/php/tests/unit/PluginLocatorTest.php
<?php /** * Plugin guesser test suite. * * @package automattic/jetpack-autoloader */ // We live in the namespace of the test autoloader to avoid many use statements. namespace Automattic\Jetpack\Autoloader\jpCurrent; use PHPUnit\Framework\TestCase; /** * Test suite class for the Autoloader part that handles act...
projects/packages/autoloader/tests/php/tests/unit/LatestAutoloaderGuardTest.php
<?php /** * Autoloader guard test suite. * * @package automattic/jetpack-autoloader */ // We live in the namespace of the test autoloader to avoid many use statements. namespace Automattic\Jetpack\Autoloader\jpCurrent; use PHPUnit\Framework\TestCase; use Test_Plugin_Factory; /** * Test suite class for the Autol...
projects/packages/autoloader/tests/php/tests/unit/PluginsHandlerTest.php
<?php /** * Plugins handler test suite. * * @package automattic/jetpack-autoloader */ // We live in the namespace of the test autoloader to avoid many use statements. namespace Automattic\Jetpack\Autoloader\jpCurrent; use PHPUnit\Framework\TestCase; /** * Test suite class for the autoloader's plugin handler. *...
projects/packages/autoloader/tests/php/tests/unit/ManifestGeneratorTest.php
<?php /** * Autoloader test suite. * * @package automattic/jetpack-autoloader */ use Automattic\Jetpack\Autoloader\ManifestGenerator; use PHPUnit\Framework\TestCase; /** * Test suite class for the manifest generator */ class ManifestGeneratorTest extends TestCase { /** * Tests that all of the manifest gener...
projects/packages/autoloader/tests/php/tests/unit/VersionLoaderTest.php
<?php /** * Class loader test suite. * * @package automattic/jetpack-autoloader */ // We live in the namespace of the test autoloader to avoid many use statements. namespace Automattic\Jetpack\Autoloader\jpCurrent; use Automattic\Jetpack\AutoloaderTesting\Current\UniqueTestClass; use Automattic\Jetpack\Autoloader...
projects/packages/autoloader/tests/php/tests/unit/HookManagerTest.php
<?php /** * The hook manager test suite. * * @package automattic/jetpack-autoloader */ // We live in the namespace of the test autoloader to avoid many use statements. namespace Automattic\Jetpack\Autoloader\jpCurrent; use PHPUnit\Framework\TestCase; /** * Provides unit tests for the methods in the Hook_Manager...
projects/packages/autoloader/tests/php/tests/unit/AutoloaderTest.php
<?php /** * Autoloader test suite. * * @package automattic/jetpack-autoloader */ // We live in the namespace of the test autoloader to avoid many use statements. namespace Automattic\Jetpack\Autoloader\jpCurrent; use PHPUnit\Framework\TestCase; use Test_Plugin_Factory; /** * Test suite class for the Autoloader....
projects/packages/autoloader/tests/php/tests/unit/ShutdownHandlerTest.php
<?php /** * Shutdown handler test suite. * * @package automattic/jetpack-autoloader */ // We live in the namespace of the test autoloader to avoid many use statements. namespace Automattic\Jetpack\Autoloader\jpCurrent; use PHPUnit\Framework\TestCase; /** * Test suite class for the Shutdown_Handler. */ class Sh...
projects/packages/autoloader/tests/php/tests/unit/AutoloaderHandlerTest.php
<?php /** * Autoloader handler test suite. * * @package automattic/jetpack-autoloader */ // We live in the namespace of the test autoloader to avoid many use statements. namespace Automattic\Jetpack\Autoloader\jpCurrent; use PHPUnit\Framework\TestCase; /** * Test suite class for the Autoloader handler. * * @r...
projects/packages/autoloader/tests/php/tests/unit/AutoloaderLocatorTest.php
<?php /** * Autoloader locator test suite. * * @package automattic/jetpack-autoloader */ // We live in the namespace of the test autoloader to avoid many use statements. namespace Automattic\Jetpack\Autoloader\jpCurrent; use PHPUnit\Framework\TestCase; use Test_Plugin_Factory; /** * Test suite class for the Aut...
projects/packages/autoloader/tests/php/tests/unit/PHPAutoloaderTest.php
<?php /** * PHP autoloader test suite. * * @package automattic/jetpack-autoloader */ // We live in the namespace of the test autoloader to avoid many use statements. namespace Automattic\Jetpack\Autoloader\jpCurrent; use Automattic\Jetpack\AutoloaderTesting\SharedTestClass; use PHPUnit\Framework\TestCase; /** *...
projects/packages/autoloader/tests/php/tests/unit/PathProcessorTest.php
<?php /** * Path processor test suite. * * @package automattic/jetpack-autoloader */ // We live in the namespace of the test autoloader to avoid many use statements. namespace Automattic\Jetpack\Autoloader\jpCurrent; use PHPUnit\Framework\TestCase; /** * Test suite class for the Autoloader part that handles pro...
projects/packages/autoloader/tests/php/tests/integration/VersionLoadingFromManifestTest.php
<?php /** * Integration test suite for the loader population. * * @package automattic/jetpack-autoloader */ // We live in the namespace of the test autoloader to avoid many use statements. namespace Automattic\Jetpack\Autoloader\jpCurrent; use Automattic\Jetpack\AutoloaderTesting\Current\UniqueTestClass; use Clas...
projects/packages/autoloader/tests/php/tests/integration/LoadingGeneratedManifestsTest.php
<?php /** * Integration test suite for the manifest reading. * * @package automattic/jetpack-autoloader */ // We live in the namespace of the test autoloader to avoid many use statements. namespace Automattic\Jetpack\Autoloader\jpCurrent; use Automattic\Jetpack\Autoloader\ManifestGenerator; use PHPUnit\Framework\...
projects/packages/autoloader/tests/php/tests/acceptance/CacheTest.php
<?php /** * Acceptance test suite for the current autoloader. * * @package automattic/jetpack-autoloader */ /** * Test suite class for verifying the functionality of the current autoloader's cache mechanism. * * @runTestsInSeparateProcesses Ensure each test has a fresh process as if it was a real request. * @p...
projects/packages/autoloader/tests/php/tests/acceptance/AutoloaderTest.php
<?php /** * Acceptance test suite for the current autoloader. * * @package automattic/jetpack-autoloader */ /** * Test suite class for verifying the functionality of the current autoloader. * * @runTestsInSeparateProcesses Ensure each test has a fresh process as if it was a real request. * @preserveGlobalState...
projects/packages/autoloader/tests/php/lib/functions.php
<?php /** * Functions required for the test suite to run. * * @package automattic/jetpack-autoloader */ // phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed /** * Since PHP8 added a warning for setting `$throw` to `false` in `spl_autoload_register()`, * we need to define the autoload functions in orde...
projects/packages/autoloader/tests/php/lib/functions-wordpress.php
<?php /** * Functions that mock WordPress core functionality for testing purposes. * * @package automattic/jetpack-autoloader */ if ( ! function_exists( 'trailingslashit' ) ) { /** * A drop-in for a WordPress core function. * * @param String $string string. * @return String */ function trailingslashit...
projects/packages/autoloader/tests/php/lib/class-test-container.php
<?php /** * Class file for container to be used in tests to override dependencies. * * @package automattic/jetpack-autoloader */ namespace Automattic\Jetpack\Autoloader\jpCurrent; /** * Class Test_Container */ class Test_Container extends Container { /** * Replaces a dependency in the container. * * @pa...
projects/packages/autoloader/tests/php/lib/class-acceptance-test-case.php
<?php /** * Base class file for all acceptance tests. * * @package automattic/jetpack-autoloader */ use Automattic\Jetpack\Autoloader\jpCurrent\Path_Processor; use Automattic\Jetpack\Autoloader\jpCurrent\Plugins_Handler; use PHPUnit\Framework\TestCase; /** * Class Acceptance_Test_Case. */ abstract class Accepta...
projects/packages/autoloader/tests/php/lib/class-test-plugin-factory.php
<?php /** * Class file for the factory that generates test plugin data. * * @package automattic/jetpack-autoloader */ /** * Class Test_Plugin_Factory */ class Test_Plugin_Factory { /** * The root namespace all of the test class files will live in. */ const TESTING_NAMESPACE = 'Automattic\\Jetpack\\Autoloa...
projects/packages/autoloader/src/AutoloadGenerator.php
<?php /** * Autoloader Generator. * * @package automattic/jetpack-autoloader */ namespace Automattic\Jetpack\Autoloader; use Composer\Composer; use Composer\Config; use Composer\Installer\InstallationManager; use Composer\IO\IOInterface; use Composer\Package\PackageInterface; use Composer\Repository\InstalledRepo...
projects/packages/autoloader/src/autoload.php
<?php /* HEADER */ // phpcs:ignore require_once __DIR__ . '/jetpack-autoloader/class-autoloader.php'; Autoloader::init();
projects/packages/autoloader/src/class-container.php
<?php /* HEADER */ // phpcs:ignore /** * This class manages the files and dependencies of the autoloader. */ class Container { /** * Since each autoloader's class files exist within their own namespace we need a map to * convert between the local class and a shared key. Note that no version checking is * per...
projects/packages/autoloader/src/class-autoloader-locator.php
<?php /* HEADER */ // phpcs:ignore use Automattic\Jetpack\Autoloader\AutoloadGenerator; /** * This class locates autoloaders. */ class Autoloader_Locator { /** * The object for comparing autoloader versions. * * @var Version_Selector */ private $version_selector; /** * The constructor. * * @param...
projects/packages/autoloader/src/class-latest-autoloader-guard.php
<?php /* HEADER */ // phpcs:ignore /** * This class ensures that we're only executing the latest autoloader. */ class Latest_Autoloader_Guard { /** * The Plugins_Handler instance. * * @var Plugins_Handler */ private $plugins_handler; /** * The Autoloader_Handler instance. * * @var Autoloader_Handl...
projects/packages/autoloader/src/class-php-autoloader.php
<?php /* HEADER */ // phpcs:ignore /** * This class handles management of the actual PHP autoloader. */ class PHP_Autoloader { /** * Registers the autoloader with PHP so that it can begin autoloading classes. * * @param Version_Loader $version_loader The class loader to use in the autoloader. */ public fu...
projects/packages/autoloader/src/AutoloadProcessor.php
<?php /** * Autoload Processor. * * @package automattic/jetpack-autoloader */ namespace Automattic\Jetpack\Autoloader; /** * Class AutoloadProcessor. */ class AutoloadProcessor { /** * A callable for scanning a directory for all of its classes. * * @var callable */ private $classmapScanner; /** *...
projects/packages/autoloader/src/class-autoloader-handler.php
<?php /* HEADER */ // phpcs:ignore use Automattic\Jetpack\Autoloader\AutoloadGenerator; /** * This class selects the package version for the autoloader. */ class Autoloader_Handler { /** * The PHP_Autoloader instance. * * @var PHP_Autoloader */ private $php_autoloader; /** * The Hook_Manager instance...
projects/packages/autoloader/src/AutoloadFileWriter.php
<?php /** * Autoloader file writer. * * @package automattic/jetpack-autoloader */ namespace Automattic\Jetpack\Autoloader; /** * Class AutoloadFileWriter. */ class AutoloadFileWriter { /** * The file comment to use. */ const COMMENT = <<<AUTOLOADER_COMMENT /** * This file was automatically generated by ...
projects/packages/autoloader/src/CustomAutoloaderPlugin.php
<?php /** * Custom Autoloader Composer Plugin, hooks into composer events to generate the custom autoloader. * * @package automattic/jetpack-autoloader */ namespace Automattic\Jetpack\Autoloader; use Composer\Composer; use Composer\EventDispatcher\EventSubscriberInterface; use Composer\IO\IOInterface; use Compose...
projects/packages/autoloader/src/class-version-selector.php
<?php /* HEADER */ // phpcs:ignore /** * Used to select package versions. */ class Version_Selector { /** * Checks whether the selected package version should be updated. Composer development * package versions ('9999999-dev' or versions that start with 'dev-') are favored * when the JETPACK_AUTOLOAD_DEV con...
projects/packages/autoloader/src/class-path-processor.php
<?php /* HEADER */ // phpcs:ignore /** * This class handles dealing with paths for the autoloader. */ class Path_Processor { /** * Given a path this will replace any of the path constants with a token to represent it. * * @param string $path The path we want to process. * * @return string The tokenized pa...
projects/packages/autoloader/src/class-hook-manager.php
<?php /* HEADER */ // phpcs:ignore /** * Allows the latest autoloader to register hooks that can be removed when the autoloader is reset. */ class Hook_Manager { /** * An array containing all of the hooks that we've registered. * * @var array */ private $registered_hooks; /** * The constructor. */ ...
projects/packages/autoloader/src/class-manifest-reader.php
<?php /* HEADER */ // phpcs:ignore /** * This class reads autoloader manifest files. */ class Manifest_Reader { /** * The Version_Selector object. * * @var Version_Selector */ private $version_selector; /** * The constructor. * * @param Version_Selector $version_selector The Version_Selector objec...
projects/packages/autoloader/src/class-plugin-locator.php
<?php /* HEADER */ // phpcs:ignore /** * This class scans the WordPress installation to find active plugins. */ class Plugin_Locator { /** * The path processor for finding plugin paths. * * @var Path_Processor */ private $path_processor; /** * The constructor. * * @param Path_Processor $path_proce...
projects/packages/autoloader/src/class-plugins-handler.php
<?php /* HEADER */ // phpcs:ignore /** * This class handles locating and caching all of the active plugins. */ class Plugins_Handler { /** * The transient key for plugin paths. */ const TRANSIENT_KEY = 'jetpack_autoloader_plugin_paths'; /** * The locator for finding plugins in different locations. * * ...
projects/packages/autoloader/src/class-autoloader.php
<?php /* HEADER */ // phpcs:ignore /** * This class handles management of the actual PHP autoloader. */ class Autoloader { /** * Checks to see whether or not the autoloader should be initialized and then initializes it if so. * * @param Container|null $container The container we want to use for autoloader in...
projects/packages/autoloader/src/ManifestGenerator.php
<?php /** * Manifest Generator. * * @package automattic/jetpack-autoloader */ // phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_var_export namespace Automattic\Jetpack\Autoloader; /** * Class ManifestGenerator. */ class ManifestGenerator { /** * Builds a manifest file for the given autoloader t...
projects/packages/autoloader/src/class-shutdown-handler.php
<?php /* HEADER */ // phpcs:ignore /** * This class handles the shutdown of the autoloader. */ class Shutdown_Handler { /** * The Plugins_Handler instance. * * @var Plugins_Handler */ private $plugins_handler; /** * The plugins cached by this autoloader. * * @var string[] */ private $cached_plu...
projects/packages/autoloader/src/class-version-loader.php
<?php /* HEADER */ // phpcs:ignore /** * This class loads other classes based on given parameters. */ class Version_Loader { /** * The Version_Selector object. * * @var Version_Selector */ private $version_selector; /** * A map of available classes and their version and file path. * * @var array ...
docs/examples/bootstrap.php
<?php /** * PHPUnit bootstrap file. * * @package automattic/jetpack */ // Assume we're in tests/php/bootstrap.php. $_plugin_root = dirname( __DIR__, 2 ); // Locate WordPress or wordpress-develop. We look in several places. if ( false !== getenv( 'WP_DEVELOP_DIR' ) ) { // Jetpack Monorepo environment variable. $...
.github/actions/tool-setup/composer-plugin/src/Plugin.php
<?php /** * Composer 304-short-circuiting plugin. * * This simple composer plugin redirects repo.packagist.org metadata URLs * to a proxy that will respond with a 304 response when it has already seen * the URL. * * @package automattic/jetpack */ namespace Automattic\Jetpack\Composer304Plugin; use Composer\Co...
.github/files/generate-ci-matrix.php
#!/usr/bin/env php <?php /** * A tool to generate a GitHub Actions matrix for the CI workflow. * * @package automattic/jetpack */ // phpcs:disable WordPress.WP.GlobalVariablesOverride chdir( __DIR__ . '/../../' ); // Default versions for PHP and Node. $versions = array(); foreach ( file( '.github/versions.sh' ) ...