PluginProbe
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO / 1.3.53
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO v1.3.53
1.4.17 1.4.16 1.4.15 1.4.14 1.4.13 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.54 1.3.53 1.3.52 1.3.51 1.3.50 1.3.49 1.3.48 All 180 releases
disco / vendor / micropackage / requirements / tests / Checker / test-ssl.php

test-ssl.php in Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO 1.3.53, at vendor/micropackage/requirements/tests/Checker/test-ssl.php

64 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class TestDocHooks
4 *
5 * @package micropackage/requirements
6 */
7
8 namespace Micropackage\Requirements\Test\Checker;
9
10 use Micropackage\Requirements\Requirements;
11 use Micropackage\Requirements\Checker\SSL as TestedChecker;
12
13 /**
14 * SSL checker test case.
15 */
16 class TestSSL extends \WP_UnitTestCase {
17
18 public function setUp() {
19 parent::setUp();
20 $this->checker = new TestedChecker();
21 }
22
23 public function bad_params() {
24 return [
25 [ '5.3' ],
26 [ 1 ],
27 [ [ true ] ],
28 ];
29 }
30
31 public function test_get_name_should_return_valid_name() {
32 $this->assertSame( 'ssl', $this->checker->get_name() );
33 }
34
35 /**
36 * @dataProvider bad_params
37 * @expectedException Exception
38 */
39 public function test_check_should_throw_exception_if_passed_not_bool_requirement( $param ) {
40 $this->checker->check( $param );
41 }
42
43 public function test_check_should_pass_when_enabled_with_ssl() {
44 // Override server data.
45 $_SERVER['HTTPS'] = '1';
46 $_SERVER['SERVER_PORT'] = '443';
47
48 $this->checker->check( true );
49
50 $this->assertEmpty( $this->checker->get_errors() );
51 }
52
53 public function test_check_should_pass_when_disabled_without_ssl() {
54 // Override server data.
55 $_SERVER['HTTPS'] = '0';
56 $_SERVER['SERVER_PORT'] = '80';
57
58 $this->checker->check( false );
59
60 $this->assertEmpty( $this->checker->get_errors() );
61 }
62
63 }
64