Changeset 40457
- Timestamp:
- 04/15/2017 10:22:29 PM (7 years ago)
- Location:
- branches/4.0/tests/phpunit/tests
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.0/tests/phpunit/tests/ms.php
r29552 r40457 1413 1413 1414 1414 /** 1415 * @ticket 278841416 *1417 * @expectedDeprecated define()1418 */1419 function test_multisite_bootstrap() {1420 global $current_site, $current_blog;1421 1422 $network_ids = array(1423 'wordpress.org/' => array( 'domain' => 'wordpress.org', 'path' => '/' ),1424 'make.wordpress.org/' => array( 'domain' => 'make.wordpress.org', 'path' => '/' ),1425 );1426 1427 foreach ( $network_ids as &$id ) {1428 $id = $this->factory->network->create( $id );1429 }1430 unset( $id );1431 1432 $ids = array(1433 'wordpress.org/' => array( 'domain' => 'wordpress.org', 'path' => '/', 'site_id' => $network_ids['wordpress.org/'] ),1434 'wordpress.org/foo/' => array( 'domain' => 'wordpress.org', 'path' => '/foo/', 'site_id' => $network_ids['wordpress.org/'] ),1435 'wordpress.org/foo/bar/' => array( 'domain' => 'wordpress.org', 'path' => '/foo/bar/', 'site_id' => $network_ids['wordpress.org/'] ),1436 'make.wordpress.org/' => array( 'domain' => 'make.wordpress.org', 'path' => '/', 'site_id' => $network_ids['make.wordpress.org/'] ),1437 'make.wordpress.org/foo/' => array( 'domain' => 'make.wordpress.org', 'path' => '/foo/', 'site_id' => $network_ids['make.wordpress.org/'] ),1438 );1439 1440 foreach ( $ids as &$id ) {1441 $id = $this->factory->blog->create( $id );1442 }1443 unset( $id );1444 1445 $this->_setup_host_request( 'wordpress.org', '/' );1446 $this->assertEquals( $ids['wordpress.org/'], $current_blog->blog_id );1447 $this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );1448 1449 $this->_setup_host_request( 'wordpress.org', '/2014/04/23/hello-world/' );1450 $this->assertEquals( $ids['wordpress.org/'], $current_blog->blog_id );1451 $this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );1452 1453 $this->_setup_host_request( 'wordpress.org', '/sample-page/' );1454 $this->assertEquals( $ids['wordpress.org/'], $current_blog->blog_id );1455 $this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );1456 1457 $this->_setup_host_request( 'wordpress.org', '/?p=1' );1458 $this->assertEquals( $ids['wordpress.org/'], $current_blog->blog_id );1459 $this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );1460 1461 $this->_setup_host_request( 'wordpress.org', '/wp-admin/' );1462 $this->assertEquals( $ids['wordpress.org/'], $current_blog->blog_id );1463 $this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );1464 1465 $this->_setup_host_request( 'wordpress.org', '/foo/' );1466 $this->assertEquals( $ids['wordpress.org/foo/'], $current_blog->blog_id );1467 $this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );1468 1469 $this->_setup_host_request( 'wordpress.org', '/FOO/' );1470 $this->assertEquals( $ids['wordpress.org/foo/'], $current_blog->blog_id );1471 $this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );1472 1473 $this->_setup_host_request( 'wordpress.org', '/foo/2014/04/23/hello-world/' );1474 $this->assertEquals( $ids['wordpress.org/foo/'], $current_blog->blog_id );1475 $this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );1476 1477 $this->_setup_host_request( 'wordpress.org', '/foo/sample-page/' );1478 $this->assertEquals( $ids['wordpress.org/foo/'], $current_blog->blog_id );1479 $this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );1480 1481 $this->_setup_host_request( 'wordpress.org', '/foo/?p=1' );1482 $this->assertEquals( $ids['wordpress.org/foo/'], $current_blog->blog_id );1483 $this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );1484 1485 $this->_setup_host_request( 'wordpress.org', '/foo/wp-admin/' );1486 $this->assertEquals( $ids['wordpress.org/foo/'], $current_blog->blog_id );1487 $this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );1488 1489 // @todo not currently passing.1490 //$this->_setup_host_request( 'wordpress.org', '/foo/bar/' );1491 //$this->assertEquals( $ids['wordpress.org/foo/bar/'], $current_blog->blog_id );1492 //$this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );1493 1494 $this->_setup_host_request( 'make.wordpress.org', '/' );1495 $this->assertEquals( $ids['make.wordpress.org/'], $current_blog->blog_id );1496 $this->assertEquals( $network_ids['make.wordpress.org/'], $current_blog->site_id );1497 1498 $this->_setup_host_request( 'make.wordpress.org', '/foo/' );1499 $this->assertEquals( $ids['make.wordpress.org/foo/'], $current_blog->blog_id );1500 $this->assertEquals( $network_ids['make.wordpress.org/'], $current_blog->site_id );1501 }1502 1503 /**1504 1415 * Reset various globals required for a 'clean' multisite boot. 1505 1416 * -
branches/4.0/tests/phpunit/tests/option/blogOption.php
r26252 r40457 20 20 parent::tearDown(); 21 21 $wpdb->suppress_errors( $this->suppress ); 22 }23 24 function test_from_same_site() {25 $key = rand_str();26 $key2 = rand_str();27 $value = rand_str();28 $value2 = rand_str();29 30 $this->assertFalse( get_blog_option( 1, 'doesnotexist' ) );31 $this->assertFalse( get_option( 'doesnotexist' ) ); // check get_option()32 33 $this->assertTrue( add_blog_option( 1, $key, $value ) );34 // Assert all values of $blog_id that means the current or main blog (the same here).35 $this->assertEquals( $value, get_blog_option( 1, $key ) );36 $this->assertEquals( $value, get_blog_option( null, $key ) );37 $this->assertEquals( $value, get_blog_option( '1', $key ) );38 $this->assertEquals( $value, get_option( $key ) ); // check get_option()39 40 $this->assertFalse( add_blog_option( 1, $key, $value ) ); // Already exists41 $this->assertFalse( update_blog_option( 1, $key, $value ) ); // Value is the same42 $this->assertTrue( update_blog_option( 1, $key, $value2 ) );43 $this->assertEquals( $value2, get_blog_option( 1, $key ) );44 $this->assertEquals( $value2, get_option( $key ) ); // check get_option()45 $this->assertFalse( add_blog_option( 1, $key, $value ) );46 $this->assertEquals( $value2, get_blog_option( 1, $key ) );47 $this->assertEquals( $value2, get_option( $key ) ); // check get_option()48 49 $this->assertTrue( delete_blog_option( 1, $key ) );50 $this->assertFalse( get_blog_option( 1, $key ) );51 $this->assertFalse( get_option( $key ) ); // check get_option()52 $this->assertFalse( delete_blog_option( 1, $key ) );53 $this->assertTrue( update_blog_option( 1, $key2, $value2 ) );54 $this->assertEquals( $value2, get_blog_option( 1, $key2 ) );55 $this->assertEquals( $value2, get_option( $key2 ) ); // check get_option()56 $this->assertTrue( delete_blog_option( 1, $key2 ) );57 $this->assertFalse( get_blog_option( 1, $key2 ) );58 $this->assertFalse( get_option( $key2 ) ); // check get_option()59 }60 61 function test_from_same_site_with_null_blog_id() {62 $key = rand_str();63 $key2 = rand_str();64 $value = rand_str();65 $value2 = rand_str();66 67 $this->assertFalse( get_blog_option( null, 'doesnotexist' ) );68 $this->assertFalse( get_option( 'doesnotexist' ) ); // check get_option()69 70 $this->assertTrue( add_blog_option( null, $key, $value ) );71 // Assert all values of $blog_id that means the current or main blog (the same here).72 $this->assertEquals( $value, get_blog_option( null, $key ) );73 $this->assertEquals( $value, get_blog_option( null, $key ) );74 $this->assertEquals( $value, get_option( $key ) ); // check get_option()75 76 $this->assertFalse( add_blog_option( null, $key, $value ) ); // Already exists77 $this->assertFalse( update_blog_option( null, $key, $value ) ); // Value is the same78 $this->assertTrue( update_blog_option( null, $key, $value2 ) );79 $this->assertEquals( $value2, get_blog_option( null, $key ) );80 $this->assertEquals( $value2, get_option( $key ) ); // check get_option()81 $this->assertFalse( add_blog_option( null, $key, $value ) );82 $this->assertEquals( $value2, get_blog_option( null, $key ) );83 $this->assertEquals( $value2, get_option( $key ) ); // check get_option()84 85 $this->assertTrue( delete_blog_option( null, $key ) );86 $this->assertFalse( get_blog_option( null, $key ) );87 $this->assertFalse( get_option( $key ) ); // check get_option()88 $this->assertFalse( delete_blog_option( null, $key ) );89 $this->assertTrue( update_blog_option( null, $key2, $value2 ) );90 $this->assertEquals( $value2, get_blog_option( null, $key2 ) );91 $this->assertEquals( $value2, get_option( $key2 ) ); // check get_option()92 $this->assertTrue( delete_blog_option( null, $key2 ) );93 $this->assertFalse( get_blog_option( null, $key2 ) );94 $this->assertFalse( get_option( $key2 ) ); // check get_option()95 22 } 96 23
Note: See TracChangeset
for help on using the changeset viewer.