Skip to content
Snippets Groups Projects
Select Git revision
  • 67f93a2833eac0888cd6ef4cee2655ebfcd5ef60
  • main default protected
  • v0.10
  • 0.10.6
  • 0.10.5
  • 0.10.4
  • 0.10.3
  • 0.10.2
  • 0.10.1
  • 0.10.0
  • 0.9.1
  • 0.9.0
12 results

I18n.php

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