# disco/1.4.21/vendor/micropackage/requirements/tests/Checker/test-ssl.php

Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO, version 1.4.21. 64 lines.

- Page: https://pluginprobe.com/plugins/disco/1.4.21/code/vendor/micropackage/requirements/tests/Checker/test-ssl.php
- Raw: https://pluginprobe.com/plugins/disco/1.4.21/raw/vendor/micropackage/requirements/tests/Checker/test-ssl.php
- Modified: 2024-09-18T11:17:48+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/disco/1.4.21/code/vendor/micropackage/requirements/tests/Checker/test-ssl.php#L10-L20`.

```php
<?php
/**
 * Class TestDocHooks
 *
 * @package micropackage/requirements
 */

namespace Micropackage\Requirements\Test\Checker;

use Micropackage\Requirements\Requirements;
use Micropackage\Requirements\Checker\SSL as TestedChecker;

/**
 * SSL checker test case.
 */
class TestSSL extends \WP_UnitTestCase {

	public function setUp() {
		parent::setUp();
		$this->checker = new TestedChecker();
	}

	public function bad_params() {
		return [
			[ '5.3' ],
			[ 1 ],
			[ [ true ] ],
		];
	}

	public function test_get_name_should_return_valid_name() {
		$this->assertSame( 'ssl', $this->checker->get_name() );
	}

	/**
	 * @dataProvider bad_params
	 * @expectedException Exception
	 */
	public function test_check_should_throw_exception_if_passed_not_bool_requirement( $param ) {
		$this->checker->check( $param );
	}

	public function test_check_should_pass_when_enabled_with_ssl() {
		// Override server data.
		$_SERVER['HTTPS']       = '1';
		$_SERVER['SERVER_PORT'] = '443';

		$this->checker->check( true );

		$this->assertEmpty( $this->checker->get_errors() );
	}

	public function test_check_should_pass_when_disabled_without_ssl() {
		// Override server data.
		$_SERVER['HTTPS']       = '0';
		$_SERVER['SERVER_PORT'] = '80';

		$this->checker->check( false );

		$this->assertEmpty( $this->checker->get_errors() );
	}

}

```
