bb = $this->make('bb_img'); } catch(Exception $e) { $this->assertTrue(false, "Couldn't load bb_img object"); } } public function testToDB() { } public function testToHTML() { $tests = array( array( 'codetext' => '{e_MEDIA_IMAGE}2020-12/5.sm.webp', 'parm' => '', 'expected' => '5.sm.webp' ), array( 'codetext' => '{e_MEDIA}images/2020-12/horse.jpg', 'parm' => 'width=300', 'expected' => 'Horse' ), array( 'codetext' => '{e_MEDIA_IMAGE}2020-12/horse.jpg', 'parm' => 'width=300', 'expected' => 'Horse' ), array( 'codetext' => '{e_THEME}voux/install/gasmask.jpg', 'parm' => 'width=300&alt=Custom&loading=auto', 'expected' => "
\"Custom\"
Custom
" ), ); foreach($tests as $var) { $result = $this->bb->toHTML($var['codetext'], $var['parm']); $result = preg_replace('/"([^"]*)thumb.php/','"thumb.php', $result); // remove the path before thumb.php $this->assertSame($var['expected'], $result); } } }