getCommand(); $command->setArguments($actualArguments); $this->assertSameValues($expectedArguments, $command->getArguments()); } /** * @group disconnected */ public function testParseResponse(): void { $this->assertSame(1, $this->getCommand()->parseResponse(1)); } /** * @group connected * @return void * @requiresRediSearchVersion >= 1.2.0 */ public function testCreatesSynonymGroupWithinGivenIndex(): void { $redis = $this->getClient(); $this->assertEquals( 'OK', $redis->ftcreate('index', (new Schema())->addTextField('text')) ); $this->assertEquals( 'OK', $redis->ftsynupdate('index', 'synonym1', null, 'term1', 'term2') ); } /** * @group connected * @return void * @requiresRediSearchVersion >= 1.2.0 */ public function testUpdatesAlreadyExistingSynonymGroupWithinGivenIndex(): void { $redis = $this->getClient(); $this->assertEquals( 'OK', $redis->ftcreate('index', (new Schema())->addTextField('text')) ); $this->assertEquals( 'OK', $redis->ftsynupdate('index', 'synonym1', null, 'term1', 'term2') ); $this->assertEquals( 'OK', $redis->ftsynupdate('index', 'synonym1', null, 'term3', 'term4') ); } /** * @group connected * @return void * @requiresRediSearchVersion >= 1.2.0 */ public function testThrowsExceptionOnNonExistingIndex(): void { $redis = $this->getClient(); $this->expectException(ServerException::class); $this->expectExceptionMessage('Unknown index name'); $redis->ftsynupdate( 'index', 'synonym1', null, 'term1' ); } public function argumentsProvider(): array { return [ 'with default arguments' => [ ['index', 'synonymGroupId', null, 'term1', 'term2'], ['index', 'synonymGroupId', 'term1', 'term2'], ], 'with SKIPINITIALSCAN modifier' => [ ['index', 'synonymGroupId', (new SynUpdateArguments())->skipInitialScan(), 'term1', 'term2'], ['index', 'synonymGroupId', 'SKIPINITIALSCAN', 'term1', 'term2'], ], ]; } }