getRequest()->setPostValue('translate', $postData); $this->dispatch('translation/ajax/index'); $result = $this->getResponse()->getBody(); $this->assertEquals($expected, $result); } /** * @return array */ public function indexActionDataProvider(): array { return [ [ [ [ 'original' => 'phrase with &', 'custom' => 'phrase with & translated', ], ], '{"phrase with &":"phrase with & translated"}', ], [ [ [ 'original' => 'phrase with &', 'custom' => 'phrase with & translated (updated)', ], ], '{"phrase with &":"phrase with & translated (updated)"}', ], [ [ [ 'original' => 'phrase with &', 'custom' => 'phrase with &', ], ], '[]', ], ]; } /** * @inheritDoc */ public static function tearDownAfterClass(): void { try { Bootstrap::getObjectManager()->get(StringUtils::class)->deleteTranslate('phrase with &'); } catch (NoSuchEntityException $exception) { //translate already deleted } parent::tearDownAfterClass(); } }