3 include( dirname( __FILE__ ) . '../../class-product.php' );
4 include( dirname( __FILE__ ) . '../../class-license-manager.php' );
6 class Yoast_Product_Double extends Yoast_Product {
9 * Construct the real Product class with our fake data
11 public function __construct() {
12 parent::__construct( get_site_url(), 'test-product', 'slug-test-product', '1.0.0' );
17 class Yoast_License_Manager_Double extends Yoast_License_Manager {
21 public function __construct() {
22 $this->product = new Yoast_Product_Double();
24 parent::__construct( $this->product );
27 public function specific_hooks() {
28 return $this->specific_hooks();
31 public function setup_auto_updater() {
32 return $this->setup_auto_updater();
36 * Wrapper for get_curl_version()
40 public function double_get_curl_version(){
41 return $this->get_curl_version();
46 class Test_Yoast_License_Manager extends Yst_License_Manager_UnitTestCase {
50 public function setUp() {
51 $this->class = new Yoast_License_Manager_Double();
55 * Make sure the API url is correct in the product
57 * @covers Yoast_License_Manager::get_api_url()
59 public function test_get_api_url(){
60 $this->assertEquals( $this->class->product->get_api_url(), get_site_url() );
64 * Make sure the API url is correct in the product
66 * @covers Yoast_License_Manager::get_curl_version()
68 public function test_get_curl_version_WITH_curl_installed_on_test_server(){
69 $curl_result = $this->class->double_get_curl_version();
71 if( function_exists('curl_version') ){
72 $curl_version = curl_version();
74 $this->assertEquals( $curl_result, $curl_version['version'] );
77 $this->assertFalse( $curl_result );