Inheritance: extends Jetpack
示例#1
0
 /**
  * @author tonykova
  * @covers Jetpack::check_identity_crisis
  * @since 3.2.0
  */
 public function test_check_identity_crisis_will_not_report_crisis_if_a_siteurl_mismatch_when_forcing_ssl()
 {
     // Kick in with force ssl and store master user data
     force_ssl_admin(true);
     Jetpack_Options::update_option('master_user', 'test');
     Jetpack_Options::update_option('user_tokens', array('test' => 'herp.derp.test'));
     add_filter('jetpack_development_mode', '__return_false', 1, 1);
     // Mock get_cloud_site_options
     $jp = $this->getMock('MockJetpack', array('get_cloud_site_options'));
     $jp->init();
     Jetpack::$instance = $jp;
     $jp->expects($this->any())->method('get_cloud_site_options')->will($this->returnValue(array('siteurl' => 'https://test.site.com')));
     // Save the mismatching option for comparison
     // Using @ to prevent throwing an error on a bug in WP core when attempting to change .htaccess
     @update_option('siteurl', 'http://test.site.com');
     // Attach hook for checking the errors
     add_filter('jetpack_has_identity_crisis', array($this, 'pre_test_check_identity_crisis_will_not_report_crisis_if_a_siteurl_mismatch_when_forcing_ssl'));
     $this->assertTrue(false !== MockJetpack::check_identity_crisis(true));
     remove_filter('jetpack_has_identity_crisis', array($this, 'pre_test_check_identity_crisis_will_not_report_crisis_if_a_siteurl_mismatch_when_forcing_ssl'));
 }
示例#2
0
 /**
  * @author  kraftbj
  * @covers Jetpack::is_staging_site
  * @since  3.9.0
  */
 public function test_is_staging_site_will_report_staging_for_wpengine_sites_by_url()
 {
     add_filter('site_url', array($this, 'pre_test_is_staging_site_will_report_staging_for_wpengine_sites_by_url'));
     $this->assertTrue(MockJetpack::is_staging_site());
     remove_filter('site_url', array($this, 'pre_test_is_staging_site_will_report_staging_for_wpengine_sites_by_url'));
 }