mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
wp-tests-config.php can/should reside in the root of a develop checkout. `phpunit` should be run from the root. see #25088. git-svn-id: https://develop.svn.wordpress.org/trunk@25165 602fd350-edb4-49c9-b593-d223f7449a82
37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @group option
|
|
*/
|
|
class Tests_Option_Transient extends WP_UnitTestCase {
|
|
|
|
function test_the_basics() {
|
|
$key = rand_str();
|
|
$value = rand_str();
|
|
$value2 = rand_str();
|
|
|
|
$this->assertFalse( get_transient( 'doesnotexist' ) );
|
|
$this->assertTrue( set_transient( $key, $value ) );
|
|
$this->assertEquals( $value, get_transient( $key ) );
|
|
$this->assertFalse( set_transient( $key, $value ) );
|
|
$this->assertTrue( set_transient( $key, $value2 ) );
|
|
$this->assertEquals( $value2, get_transient( $key ) );
|
|
$this->assertTrue( delete_transient( $key ) );
|
|
$this->assertFalse( get_transient( $key ) );
|
|
$this->assertFalse( delete_transient( $key ) );
|
|
}
|
|
|
|
function test_serialized_data() {
|
|
$key = rand_str();
|
|
$value = array( 'foo' => true, 'bar' => true );
|
|
|
|
$this->assertTrue( set_transient( $key, $value ) );
|
|
$this->assertEquals( $value, get_transient( $key ) );
|
|
|
|
$value = (object) $value;
|
|
$this->assertTrue( set_transient( $key, $value ) );
|
|
$this->assertEquals( $value, get_transient( $key ) );
|
|
$this->assertTrue( delete_transient( $key ) );
|
|
}
|
|
}
|