2014-11-18 16:22:14 +00:00
|
|
|
<?php
|
2015-03-06 15:32:40 +00:00
|
|
|
namespace WooCommerce\Tests\Util;
|
|
|
|
|
2014-11-18 16:22:14 +00:00
|
|
|
/**
|
2015-03-06 15:32:40 +00:00
|
|
|
* Class Conditional_Functions
|
|
|
|
* @package WooCommerce\Tests\Util
|
2014-11-18 16:22:14 +00:00
|
|
|
* @since 2.3.0
|
|
|
|
*/
|
2015-03-06 15:32:40 +00:00
|
|
|
class Conditional_Functions extends \WC_Unit_Test_Case {
|
2014-11-18 16:22:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test is_store_notice_showing()
|
|
|
|
*
|
|
|
|
* @since 2.3.0
|
|
|
|
*/
|
|
|
|
public function test_is_store_notice_showing() {
|
|
|
|
|
|
|
|
$this->assertEquals( false, is_store_notice_showing() );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test wc_tax_enabled()
|
|
|
|
*
|
|
|
|
* @since 2.3.0
|
|
|
|
*/
|
|
|
|
public function test_wc_tax_enabled() {
|
|
|
|
|
|
|
|
$this->assertEquals( false, wc_tax_enabled() );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test wc_prices_include_tax()
|
|
|
|
*
|
|
|
|
* @since 2.3.0
|
|
|
|
*/
|
|
|
|
public function test_wc_prices_include_tax() {
|
|
|
|
|
|
|
|
$this->assertEquals( false, wc_prices_include_tax() );
|
|
|
|
}
|
2015-03-03 11:37:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test wc_is_valid_url()
|
|
|
|
*
|
|
|
|
* @since 2.3.0
|
|
|
|
*/
|
|
|
|
public function test_wc_is_valid_url() {
|
|
|
|
|
|
|
|
// Test some invalid URLs
|
|
|
|
$this->assertEquals( false, wc_is_valid_url( 'google.com' ) );
|
|
|
|
$this->assertEquals( false, wc_is_valid_url( 'ftp://google.com' ) );
|
|
|
|
$this->assertEquals( false, wc_is_valid_url( 'sftp://google.com' ) );
|
|
|
|
$this->assertEquals( false, wc_is_valid_url( 'https://google.com/test invalid' ) );
|
|
|
|
|
|
|
|
// Test some valid URLs
|
|
|
|
$this->assertEquals( true, wc_is_valid_url( 'http://google.com' ) );
|
|
|
|
$this->assertEquals( true, wc_is_valid_url( 'https://google.com' ) );
|
|
|
|
$this->assertEquals( true, wc_is_valid_url( 'https://google.com/test%20valid' ) );
|
|
|
|
$this->assertEquals( true, wc_is_valid_url( 'https://google.com/test-valid/?query=test' ) );
|
|
|
|
$this->assertEquals( true, wc_is_valid_url( 'https://google.com/test-valid/#hash' ) );
|
|
|
|
}
|
2014-11-18 16:22:14 +00:00
|
|
|
}
|