/** * @test * @dataProvider shortcodeProvider */ public function replacerRestoresIdsFromVpidsInEntity($expectedReplacedOutput, $input) { $shortcodesReplacer = new ShortcodesReplacer($this->shortcodesInfo, $this->vpidRepository); $testingPost = ['post_title' => $input, 'post_content' => $input]; $expectedPost = ['post_title' => $input, 'post_content' => $expectedReplacedOutput]; $entityWithReplacedShortCodes = $shortcodesReplacer->restoreShortcodesInEntity('post', $testingPost); $this->assertEquals($expectedPost, $entityWithReplacedShortCodes); }
private function restoreShortcodesInAllEntities() { foreach ($this->entities as $entity) { $replacedEntity = $this->shortcodesReplacer->restoreShortcodesInEntity($this->entityName, $entity); if ($entity != $replacedEntity) { $this->updateEntityInDatabase($replacedEntity); } } }