changeURL = new ChangeURLScript(); } public function testChangeToNewURLIDToZAndSaveInDatabase() { $this->changeURL->run(['tables' => ['blocks' => ['content']]]); $resultEx = '
V minulém roce představené jistítko Beal Birdie'; $result = sqlQueryBuilder()->select('content') ->from('blocks') ->where(Operator::equals(['id' => 1])) ->execute()->fetch(); $this->assertEquals($resultEx, $result['content']); } public function testChangeToNewURLSectionWithHTTPS() { $text = 'Test content '; $result = $this->changeURL->changeURLInText($text); $resultEx = 'Test content '; $this->assertEquals($resultEx, $result); } public function testChangeToNewURLSectionWithoutDomain() { $text = 'Test content '; $result = $this->changeURL->changeURLInText($text); $resultEx = 'Test content '; $this->assertEquals($resultEx, $result); } public function testChangeToNewURLSectionWithoutDomainNotExist() { $text = 'Test content '; $result = $this->changeURL->changeURLInText($text); $resultEx = 'Test content '; $this->assertEquals($resultEx, $result); } public function testChangeToNewURLSectionWithoutDomainNotExistAndNotSaveToDB() { $this->changeURL->run(['tables' => ['blocks' => ['content']]]); $resultEx = 'Test content '; $result = sqlQueryBuilder()->select('content') ->from('blocks') ->where(Operator::equals(['id' => 3])) ->execute()->fetch(); $this->assertEquals($resultEx, $result['content']); } public function testChangeToNewURLSectionMultipleURLs() { $text = 'Test content test dalsiho textu '; $result = $this->changeURL->changeURLInText($text); $resultEx = 'Test content test dalsiho textu '; $this->assertEquals($resultEx, $result); } public function testChangeToNewURLSectionJSONsaveToDB() { $this->changeURL->run(['tables' => ['blocks' => ['json_content']]]); $result = sqlQueryBuilder()->select('json_content') ->from('blocks') ->where(Operator::equals(['id' => 2])) ->execute()->fetch(); $resultEx = '[{"type":"legacy","id":"511f33d5-7ab9-4332-85d7-0da723ed6240","settings":{"html":"Test content "}}]'; $this->assertEquals($resultEx, $result['json_content']); } protected function getDataSet() { sqlQuery('DELETE FROM articles'); return $this->getJsonDataSetFromFile(); } }