Example #1
0
 public static function tearDown()
 {
     if (self::$type === HookMock::WP_MOCK) {
         \WP_Mock::tearDown();
     }
     self::$type = null;
 }
Example #2
0
 public function tearDown()
 {
     \WP_Mock::tearDown();
     $cls = new ReflectionClass(\Dxw\Iguana\Registrar::class);
     $property = $cls->getProperty('singleton');
     $property->setAccessible(true);
     $property->setValue(null);
 }
 function tearDown()
 {
     parent::tearDown();
     WP_Mock::tearDown();
     unset($this->product_factory);
     unset($this->key_factory);
     unset($this->activation_factory);
     unset($this->release_factory);
     unset($this->update_factory);
 }
Example #4
0
 private function make_request()
 {
     $url = 'http://acme.org/new-authz';
     $response = MockData::get_head_response();
     \WP_Mock::setUp();
     // Mock the remote request
     \WP_Mock::wpFunction('wp_remote_request', array('args' => array($url, array('body' => '')), 'times' => 1, 'return' => $response));
     $nonce = new \LEWP\Request\Nonce($url);
     $nonce->send();
     \WP_Mock::tearDown();
     return $nonce;
 }
 private function get_directory_object()
 {
     $url = 'http://acme.org/directory';
     $args = array('body' => '');
     $response = MockData::get_directory_response();
     \WP_Mock::setUp();
     // Mock the remote request
     \WP_Mock::wpFunction('wp_remote_request', array('args' => array($url, $args), 'times' => 1, 'return' => $response));
     $directory = new \LEWP\Request\Directory($url);
     $directory->send();
     \WP_Mock::tearDown();
     return $directory;
 }
 public function test_send_generates_response_and_sets_properties()
 {
     $url = 'http://acme.org/directory';
     $args = array('body' => '');
     $response = MockData::get_directory_response();
     \WP_Mock::setUp();
     // Mock the remote request
     \WP_Mock::wpFunction('wp_remote_request', array('args' => array($url, $args), 'times' => 1, 'return' => $response));
     $directory = new \LEWP\Request\Directory($url);
     $this->assertEquals($response, $directory->send());
     $this->assertEquals($response, $directory->get_response());
     $this->assertEquals($response['body'], $directory->get_body());
     $this->assertEquals($response['headers']['replay-nonce'], $directory->get_response_nonce());
     \WP_Mock::tearDown();
 }
Example #7
0
 protected function tearDown()
 {
     \WP_Mock::tearDown();
 }
 public function tearDown()
 {
     WP::tearDown();
 }
Example #9
0
 /**
  * @return null
  */
 public function tearDown()
 {
     WP_Mock::tearDown();
     Mockery::close();
 }
Example #10
0
 public function tearDown()
 {
     WP::tearDown();
     unset($this->plugin);
 }
 function tearDown()
 {
     \WP_Mock::tearDown();
     parent::tearDown();
 }
Example #12
0
 function tearDown()
 {
     global $WPCF7_Submission_mock;
     \WP_Mock::tearDown();
     $WPCF7_Submission_mock = null;
 }
 /**
  * Clean up after the test is run
  */
 function tearDown()
 {
     \WP_Mock::tearDown();
     unset($this->instance);
 }
 public function tearDown()
 {
     \WP_Mock::tearDown();
 }
Example #15
0
 public function tearDown()
 {
     \WP_Mock::tearDown();
     \Dxw\Iguana\Theme\Layout::$wordpress_template = null;
     \Dxw\Iguana\Theme\Layout::$base = null;
 }
<?php

if (!defined('PROJECT')) {
    define('PROJECT', __DIR__ . '/includes/');
}
// Place any additional bootstrapping requirements here for PHP Unit.
if (!defined('WP_LANG_DIR')) {
    define('WP_LANG_DIR', 'lang_dir');
}
if (!defined('CW_THEME_INCLUDES')) {
    define('CW_THEME_INCLUDES', PROJECT);
}
if (!file_exists(__DIR__ . '/vendor/autoload.php')) {
    throw new PHPUnit_Framework_Exception('ERROR' . PHP_EOL . PHP_EOL . 'You must use Composer to install the test suite\'s dependencies!' . PHP_EOL);
}
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/tests/phpunit/test-tools/TestCase.php';
WP_Mock::setUsePatchwork(true);
WP_Mock::bootstrap();
WP_Mock::tearDown();
 public function tearDown()
 {
     WP_Mock::tearDown();
     global $wp_query;
     unset($wp_query);
 }