<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
alleyinteractive / wp-page-cache-control example snippets
wp_page_cache_control()->ttl( 3600 );
wp_page_cache_control()->disable_cache();
wp_page_cache_control()->disable_cache_for_user();
// enabling it again via:
wp_page_cache_control()->enable_cache_for_user();
wp_page_cache_control()->register_group( 'special-user-group' );
// Add the current user to the group (only needs to be done once).
wp_page_cache_control()->set_group_for_user( 'special-user-group', 'segment' );
use Alley\WP\WP_Page_Cache_Control\Header;
Header::fake();
namespace Alley\WP\My_Plugin\Tests;
use Alley\WP\WP_Page_Cache_Control\Concerns\Tests_Headers;
use Alley\WP\WP_Page_Cache_Control\Header;
use Mantle\Testkit\Test_Case;
class Example_Test extends Test_Case {
use Tests_Headers;
protected function setUp(): void {
parent::setUp();
Header::fake();
}
public function test_example() {
// Perform some action that should send a header.
static::assertHeaderSent( 'X-My-Header', 'optional value' );
static::assertHeaderNotSent( 'X-My-Other-Header', 'optional value' );
// static::assertAnyHeadersSent() and static::assertNoHeadersSent()
// are also available to assert that any headers were sent or not sent.
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.