|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +/* |
| 6 | + * Copyright MacFJA |
| 7 | + * |
| 8 | + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated |
| 9 | + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the |
| 10 | + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to |
| 11 | + * permit persons to whom the Software is furnished to do so, subject to the following conditions: |
| 12 | + * |
| 13 | + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the |
| 14 | + * Software. |
| 15 | + * |
| 16 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE |
| 17 | + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
| 18 | + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 19 | + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 20 | + */ |
| 21 | + |
| 22 | +namespace MacFJA\RediSearch\tests\Redis\Client; |
| 23 | + |
| 24 | +use MacFJA\RediSearch\tests\fixtures\Redis\Client\FakeAbstractClient; |
| 25 | +use PHPUnit\Framework\TestCase; |
| 26 | + |
| 27 | +/** |
| 28 | + * @covers \MacFJA\RediSearch\Redis\Client\AbstractClient |
| 29 | + * |
| 30 | + * @internal |
| 31 | + */ |
| 32 | +class AbstractClientTest extends TestCase |
| 33 | +{ |
| 34 | + public function testGetMissingMessage(): void |
| 35 | + { |
| 36 | + $fake = new FakeAbstractClient(); |
| 37 | + |
| 38 | + static::assertSame( |
| 39 | + 'The dependency foo is missing.'.PHP_EOL.'Install the dependency or use a polyfill.', |
| 40 | + $fake->exposeGetMissingMessage('foo', false, []) |
| 41 | + ); |
| 42 | + |
| 43 | + static::assertSame( |
| 44 | + 'The dependency bar is missing.'.PHP_EOL.'Install the dependency or use a polyfill that provide the class "baz" and the method "baz::hello".', |
| 45 | + $fake->exposeGetMissingMessage('bar', false, ['baz' => ['hello']]) |
| 46 | + ); |
| 47 | + |
| 48 | + static::assertSame( |
| 49 | + 'The dependency baz is missing.'.PHP_EOL.'Install the dependency or use a polyfill that provide the function "foobar".', |
| 50 | + $fake->exposeGetMissingMessage('baz', false, [], ['foobar']) |
| 51 | + ); |
| 52 | + |
| 53 | + static::assertSame( |
| 54 | + 'The dependency DEP is missing.'.PHP_EOL.'Install the dependency or use a polyfill that provide the classes "C", "CL" and the methods "C::m", "C::e", "CL::t", "CL::h" and the functions "f", "u".', |
| 55 | + $fake->exposeGetMissingMessage('DEP', false, ['C' => ['m', 'e'], 'CL' => ['t', 'h']], ['f', 'u']) |
| 56 | + ); |
| 57 | + |
| 58 | + static::assertSame( |
| 59 | + 'The extension foobar is missing.'.PHP_EOL.'Install the extension or use a polyfill.', |
| 60 | + $fake->exposeGetMissingMessage('foobar', true, []) |
| 61 | + ); |
| 62 | + } |
| 63 | +} |
0 commit comments