tarantool-php /
client
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * This file is part of the tarantool/client package. |
||
| 5 | * |
||
| 6 | * (c) Eugene Leonovich <[email protected]> |
||
| 7 | * |
||
| 8 | * For the full copyright and license information, please view the LICENSE |
||
| 9 | * file that was distributed with this source code. |
||
| 10 | */ |
||
| 11 | |||
| 12 | declare(strict_types=1); |
||
| 13 | |||
| 14 | namespace Tarantool\Client\Tests\Integration\Connection; |
||
| 15 | |||
| 16 | use Tarantool\Client\Exception\CommunicationFailed; |
||
| 17 | use Tarantool\Client\Tests\Integration\ClientBuilder; |
||
| 18 | use Tarantool\Client\Tests\Integration\FakeServer\FakeServerBuilder; |
||
|
0 ignored issues
–
show
|
|||
| 19 | use Tarantool\Client\Tests\Integration\FakeServer\Handler\WriteHandler; |
||
| 20 | use Tarantool\Client\Tests\Integration\TestCase; |
||
| 21 | |||
| 22 | final class ParseGreetingTest extends TestCase |
||
| 23 | { |
||
| 24 | /** |
||
| 25 | * @dataProvider \Tarantool\Client\Tests\GreetingDataProvider::provideGreetingsWithInvalidServerName |
||
| 26 | */ |
||
| 27 | public function testParseGreetingWithInvalidServerName(string $greeting) : void |
||
| 28 | { |
||
| 29 | $clientBuilder = ClientBuilder::createForFakeServer(); |
||
| 30 | |||
| 31 | FakeServerBuilder::create(new WriteHandler($greeting)) |
||
| 32 | ->setUri($clientBuilder->getUri()) |
||
| 33 | ->start(); |
||
| 34 | |||
| 35 | $client = $clientBuilder->build(); |
||
| 36 | |||
| 37 | try { |
||
| 38 | $client->ping(); |
||
| 39 | } catch (CommunicationFailed $e) { |
||
| 40 | self::assertMatchesRegularExpression( |
||
| 41 | '/Error reading greeting:.+Unable to connect/i', |
||
| 42 | $e->getMessage() |
||
| 43 | ); |
||
| 44 | |||
| 45 | return; |
||
| 46 | } catch (\RuntimeException $e) { |
||
| 47 | self::assertSame('Unable to recognize Tarantool server', $e->getMessage()); |
||
| 48 | |||
| 49 | return; |
||
| 50 | } |
||
| 51 | |||
| 52 | self::fail(); |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @dataProvider \Tarantool\Client\Tests\GreetingDataProvider::provideGreetingsWithInvalidSalt |
||
| 57 | */ |
||
| 58 | public function testParseGreetingWithInvalidSalt(string $greeting) : void |
||
| 59 | { |
||
| 60 | $clientBuilder = ClientBuilder::createForFakeServer(); |
||
| 61 | |||
| 62 | FakeServerBuilder::create(new WriteHandler($greeting)) |
||
| 63 | ->setUri($clientBuilder->getUri()) |
||
| 64 | ->start(); |
||
| 65 | |||
| 66 | $client = $clientBuilder->setOptions(['username' => 'guest'])->build(); |
||
| 67 | |||
| 68 | $this->expectException(\RuntimeException::class); |
||
| 69 | $this->expectExceptionMessageMatches('/(Unable to decode salt|Salt is too short)/'); |
||
| 70 | |||
| 71 | $client->ping(); |
||
| 72 | } |
||
| 73 | } |
||
| 74 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths