Skip to content
Snippets Groups Projects
Select Git revision
  • 3411730beafd121ec7ac81b0589bfe17b61b6227
  • master default protected
  • fix/woo-stubs-dir
  • default-packages
  • use-internal-packages
  • update-setup
  • feature/wpdesk-cs
  • 2.5.3
  • 2.5.2
  • 2.5.1
  • 2.5.0
  • 2.4.2
  • 2.4.1
  • 2.4.0
  • 2.3
  • 2.2.1
  • 2.2
  • 2.1
  • 2.0
  • 1.10.15
  • 1.10.12
  • 1.10.8
  • 1.10.7
  • 1.10.6
  • 1.10.5
  • 1.10.3
  • 1.10.2
27 results

phpcs.xml.dist

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());
        }
    
    
    }