|
2 | 2 |
|
3 | 3 | namespace SkyVerge\WooCommerce\PluginFramework\v5_15_0\Tests\Unit;
|
4 | 4 |
|
| 5 | +use Generator; |
5 | 6 | use Mockery;
|
6 | 7 | use ReflectionException;
|
7 | 8 | use SkyVerge\WooCommerce\PluginFramework\v5_15_0\SV_WC_Plugin;
|
@@ -85,4 +86,62 @@ public function testCanCatchFailedAssertion() : void
|
85 | 86 | $this->invokeInaccessibleMethod($this->testObject, 'assert', false)
|
86 | 87 | );
|
87 | 88 | }
|
| 89 | + |
| 90 | + /** |
| 91 | + * @covers \SkyVerge\WooCommerce\PluginFramework\v5_15_0\SV_WC_Plugin::maybeHandleBackwardsCompatibleArgs() |
| 92 | + * @dataProvider providerCanMaybeHandleBackwardsCompatibleArgs |
| 93 | + * @throws ReflectionException |
| 94 | + */ |
| 95 | + public function testCanMaybeHandleBackwardsCompatibleArgs(array $inputArgs, array $outputArgs): void |
| 96 | + { |
| 97 | + $this->assertSame( |
| 98 | + $outputArgs, |
| 99 | + $this->invokeInaccessibleMethod($this->testObject, 'maybeHandleBackwardsCompatibleArgs', $inputArgs) |
| 100 | + ); |
| 101 | + } |
| 102 | + |
| 103 | + /** @see testCanMaybeHandleBackwardsCompatibleArgs */ |
| 104 | + public function providerCanMaybeHandleBackwardsCompatibleArgs(): Generator |
| 105 | + { |
| 106 | + yield 'no HPOS args' => [ |
| 107 | + 'inputArgs' => [], |
| 108 | + 'outputArgs' => [], |
| 109 | + ]; |
| 110 | + |
| 111 | + yield 'old HPOS args, no support' => [ |
| 112 | + 'inputArgs' => [ |
| 113 | + 'supports_hpos' => false, |
| 114 | + ], |
| 115 | + 'outputArgs' => [ |
| 116 | + 'supported_features' => [ |
| 117 | + 'hpos' => false, |
| 118 | + ], |
| 119 | + ], |
| 120 | + ]; |
| 121 | + |
| 122 | + yield 'old HPOS args, has support' => [ |
| 123 | + 'inputArgs' => [ |
| 124 | + 'supports_hpos' => true, |
| 125 | + ], |
| 126 | + 'outputArgs' => [ |
| 127 | + 'supported_features' => [ |
| 128 | + 'hpos' => true, |
| 129 | + ], |
| 130 | + ], |
| 131 | + ]; |
| 132 | + |
| 133 | + yield 'old HPOS args and new HPOS args' => [ |
| 134 | + 'inputArgs' => [ |
| 135 | + 'supports_hpos' => true, |
| 136 | + 'supported_features' => [ |
| 137 | + 'hpos' => false, |
| 138 | + ], |
| 139 | + ], |
| 140 | + 'outputArgs' => [ |
| 141 | + 'supported_features' => [ |
| 142 | + 'hpos' => false, |
| 143 | + ], |
| 144 | + ], |
| 145 | + ]; |
| 146 | + } |
88 | 147 | }
|
0 commit comments