/** * This is taking data OUT of the database and sending it into the page. * @dataProvider contentsFrom */ public function testFrom($from, $to) { self::createPage('Awesome'); self::createPage('All Right', '/awesome'); $c = new \Concrete\Block\Content\Controller(); $translated = $c->translateFrom($from); $this->assertEquals($to, $translated); }
public function testFrom() { $from = '<p>This is really nice.</p><concrete-picture fID="1" alt="Happy Cat" />'; // create the default storage location first. mkdir($this->getStorageDirectory()); $this->getStorageLocation(); $fi = new \Concrete\Core\File\Importer(); $file = dirname(__FILE__) . '/fixtures/background-slider-blue-sky.png'; $r = $fi->import($file, 'background-slider-blue-sky.png'); $path = $r->getRelativePath(); $translated = \Concrete\Core\Editor\LinkAbstractor::translateFrom($from); $to = '<p>This is really nice.</p><img src="' . $path . '" alt="Happy Cat" width="48" height="20">'; $this->assertEquals('background-slider-blue-sky.png', $r->getFilename()); $this->assertEquals($to, $translated); $c = new \Concrete\Block\Content\Controller(); $c->content = $from; $sx = new SimpleXMLElement('<test />'); $c->export($sx); $content = (string) $sx->data->record->content; $this->assertEquals('<p>This is really nice.</p><concrete-picture alt="Happy Cat" file="background-slider-blue-sky.png" />', $content); }