getScriptsHtml() public method

Get the script list as html tags.
public getScriptsHtml ( ) : string
return string
Example #1
0
 public function testScripts()
 {
     $view = new View();
     $scriptOne = 'scriptOne.js';
     $scriptTwo = 'scriptTwo.js';
     $scriptThree = 'scriptThree.js';
     $view->appendScript($scriptOne);
     $view->prependScript($scriptTwo);
     $view->appendScript($scriptThree);
     $scriptArray = $view->getScripts();
     $expectedArray = [['path' => $scriptTwo, 'type' => 'text/javascript'], ['path' => $scriptOne, 'type' => 'text/javascript'], ['path' => $scriptThree, 'type' => 'text/javascript']];
     $this->assertSame($expectedArray, $scriptArray);
     $html = '';
     foreach ($expectedArray as $s) {
         $html .= '<script type="' . $s['type'] . '" src="' . $s['path'] . '"></script>' . "\n";
     }
     $this->assertSame($html, $view->getScriptsHtml());
 }