Skip to content
Snippets Groups Projects
Select Git revision
  • 265f521ac09673c22c7b2788a5637657918fe3c0
  • master default protected
  • bugfix/wordpress-review
  • fix/duplicate
  • bugfix/get_current_screen_fail
  • feature/dismiss-nonce
  • replace-dodgy-path
  • bugfix/notice-not-show
  • devel
  • 3.3.0
  • 3.2.5
  • 3.2.4
  • 3.2.3
  • 3.2.2
  • 3.2.1
  • 3.2.0
  • 3.2.0-beta7
  • 3.2.0-beta6
  • 3.2.0-beta5
  • 3.2.0-beta4
  • 3.2.0-beta3
  • 3.2.0-beta2
  • 3.2.0-beta1
  • 3.1.4
  • 3.1.4-beta1
  • 3.1.3
  • 3.1.1
  • 3.1
  • 3.0
29 results

notice.js

Blame
  • TestShippingMethodInstanceStrategy.php 1.10 KiB
    <?php
    
    namespace unit\WooCommerce;
    
    
    use WP_Mock\Tools\TestCase;
    use WPDesk\ShowDecision\WooCommerce\ShippingMethodInstanceStrategy;
    
    class TestShippingMethodInstanceStrategy extends TestCase
    {
    
        public function testShouldReturnTrueWhenShipppingMethodInstanceMatches()
        {
            // Expect
            \WP_Mock::passthruFunction('sanitize_key');
    
            // Given
            $_GET =
                [ 'page' => 'wc-settings', 'tab' => 'shipping', 'instance_id' => '1' ]
            ;
            $strategy = new ShippingMethodInstanceStrategy( new \WC_Shipping_Zones(), 'test_id');
    
            // When & Then
            $this->assertTrue($strategy->shouldDisplay());
        }
    
        public function testShouldReturnFalseWhenShipppingMethodInstanceDoesNotMatch()
        {
            // Expect
            \WP_Mock::passthruFunction('sanitize_key');
    
            // Given
            $_GET =
                [ 'page' => 'wc-settings', 'tab' => 'shipping', 'instance_id' => '2' ]
            ;
            $strategy = new ShippingMethodInstanceStrategy( new \WC_Shipping_Zones(), 'other_test_id');
    
            // When & Then
            $this->assertFalse($strategy->shouldDisplay());
        }
    
    
    }