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-wp.php

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

76 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class TestWP
4 *
5 * @package micropackage/requirements
6 */
7
8 namespace Micropackage\Requirements\Test\Checker;
9
10 use phpmock\Mock;
11 use Micropackage\Requirements\Requirements;
12 use Micropackage\Requirements\Checker\WP as TestedChecker;
13
14 /**
15 * PHP checker test case.
16 */
17 class TestWP extends \WP_UnitTestCase {
18
19 use \phpmock\phpunit\PHPMock;
20
21 public function setUp() {
22 parent::setUp();
23 $this->checker = new TestedChecker();
24 }
25
26 public function tearDown() {
27 parent::tearDown();
28 Mock::disableAll();
29 }
30
31 public function test_get_name_should_return_valid_name() {
32 $this->assertSame( 'wp', $this->checker->get_name() );
33 }
34
35 /**
36 * @expectedException Exception
37 */
38 public function test_check_should_throw_exception_if_passed_not_numeric_or_string_requirement() {
39 $this->checker->check( [ '5.3' ] );
40 }
41
42 /**
43 * @doesNotPerformAssertions
44 */
45 public function test_check_should_accept_numeric_or_string_requirement() {
46
47 $get_bloginfo = $this->getFunctionMock( 'Micropackage\Requirements\Checker', 'get_bloginfo' );
48 $get_bloginfo->expects( $this->any() )->willReturn( '5.4' );
49
50 $this->checker->check( '5.3+hotfix' );
51 $this->checker->check( '5.3' );
52 $this->checker->check( 5.3 );
53 $this->checker->check( 5 );
54
55 }
56
57 public function test_check_should_pass_when_using_the_same_version() {
58 $get_bloginfo = $this->getFunctionMock( 'Micropackage\Requirements\Checker', 'get_bloginfo' );
59 $get_bloginfo->expects( $this->once() )->willReturn( '5.3.1' );
60
61 $this->checker->check( '5.3.1' );
62
63 $this->assertEmpty( $this->checker->get_errors() );
64 }
65
66 public function test_check_should_not_pass_when_using_lower_version() {
67 $get_bloginfo = $this->getFunctionMock( 'Micropackage\Requirements\Checker', 'get_bloginfo' );
68 $get_bloginfo->expects( $this->once() )->willReturn( '5.0.2' );
69
70 $this->checker->check( '5.3' );
71
72 $this->assertNotEmpty( $this->checker->get_errors() );
73 }
74
75 }
76