@@ 1138-1171 (lines=34) @@ | ||
1135 | $this->assertTrue( is_array( $wp_taxonomies['category']->rewrite ) ); |
|
1136 | } |
|
1137 | ||
1138 | function test_initial_sync_doesnt_sync_subscribers() { |
|
1139 | $this->factory->user->create( array( 'user_login' => 'theauthor', 'role' => 'author' ) ); |
|
1140 | $this->factory->user->create( array( 'user_login' => 'theadmin', 'role' => 'administrator' ) ); |
|
1141 | foreach ( range( 1, 10 ) as $i ) { |
|
1142 | $this->factory->user->create( array( 'role' => 'subscriber' ) ); |
|
1143 | } |
|
1144 | $this->full_sync->start(); |
|
1145 | $this->sender->do_full_sync(); |
|
1146 | $this->assertEquals( 13, $this->server_replica_storage->user_count() ); |
|
1147 | $this->server_replica_storage->reset(); |
|
1148 | $this->assertEquals( 0, $this->server_replica_storage->user_count() ); |
|
1149 | $user_ids = Modules::get_module( 'users' )->get_initial_sync_user_config(); |
|
1150 | $this->assertEquals( 3, count( $user_ids ) ); |
|
1151 | $this->full_sync->start( array( 'users' => 'initial' ) ); |
|
1152 | $this->sender->do_full_sync(); |
|
1153 | $this->assertEquals( 3, $this->server_replica_storage->user_count() ); |
|
1154 | // finally, let's make sure that the initial sync method actually invokes our initial sync user config |
|
1155 | Actions::do_initial_sync(); |
|
1156 | $current_user = wp_get_current_user(); |
|
1157 | ||
1158 | $expected_sync_config = array( |
|
1159 | 'options' => true, |
|
1160 | 'functions' => true, |
|
1161 | 'constants' => true, |
|
1162 | 'users' => array( $current_user->ID ), |
|
1163 | 'network_options' => true, |
|
1164 | ); |
|
1165 | ||
1166 | $full_sync_status = $this->full_sync->get_status(); |
|
1167 | $this->assertEquals( |
|
1168 | $expected_sync_config, |
|
1169 | $full_sync_status['config'] |
|
1170 | ); |
|
1171 | } |
|
1172 | ||
1173 | ||
1174 | function test_full_sync_sends_previous_interval_end_on_posts() { |
@@ 1490-1523 (lines=34) @@ | ||
1487 | $this->assertTrue( is_array( $wp_taxonomies['category']->rewrite ) ); |
|
1488 | } |
|
1489 | ||
1490 | function test_initial_sync_doesnt_sync_subscribers() { |
|
1491 | $this->factory->user->create( array( 'user_login' => 'theauthor', 'role' => 'author' ) ); |
|
1492 | $this->factory->user->create( array( 'user_login' => 'theadmin', 'role' => 'administrator' ) ); |
|
1493 | foreach( range( 1, 10 ) as $i ) { |
|
1494 | $this->factory->user->create( array( 'role' => 'subscriber' ) ); |
|
1495 | } |
|
1496 | $this->full_sync->start(); |
|
1497 | $this->sender->do_full_sync(); |
|
1498 | $this->assertEquals( 13, $this->server_replica_storage->user_count() ); |
|
1499 | $this->server_replica_storage->reset(); |
|
1500 | $this->assertEquals( 0, $this->server_replica_storage->user_count() ); |
|
1501 | $user_ids = Modules::get_module( 'users' )->get_initial_sync_user_config(); |
|
1502 | $this->assertEquals( 3, count( $user_ids ) ); |
|
1503 | $this->full_sync->start( array( 'users' => 'initial' ) ); |
|
1504 | $this->sender->do_full_sync(); |
|
1505 | $this->assertEquals( 3, $this->server_replica_storage->user_count() ); |
|
1506 | // finally, let's make sure that the initial sync method actually invokes our initial sync user config |
|
1507 | Actions::do_initial_sync( '4.2', '4.1' ); |
|
1508 | $current_user = wp_get_current_user(); |
|
1509 | ||
1510 | $expected_sync_config = array( |
|
1511 | 'options' => true, |
|
1512 | 'functions' => true, |
|
1513 | 'constants' => true, |
|
1514 | 'users' => array( $current_user->ID ), |
|
1515 | 'network_options' => true, |
|
1516 | ); |
|
1517 | ||
1518 | $full_sync_status = $this->full_sync->get_status(); |
|
1519 | $this->assertEquals( |
|
1520 | $expected_sync_config, |
|
1521 | $full_sync_status[ 'config' ] |
|
1522 | ); |
|
1523 | } |
|
1524 | ||
1525 | function test_full_sync_enqueues_limited_number_of_items() { |
|
1526 | Settings::update_settings( array( 'max_enqueue_full_sync' => 2 ) ); |