/** * @depends testRenderScripts * * @dataProvider providerRenderScriptsBatch * * @param array $scriptBatch * @param integer $expectedScriptTagCount * * @see https://github.com/yiisoft/yii/issues/2770 */ public function testRenderScriptsBatch(array $scriptBatch, $expectedScriptTagCount) { $this->_clientScript->reset(); foreach ($scriptBatch as $scriptParams) { $this->_clientScript->registerScript($scriptParams['id'], $scriptParams['script'], $scriptParams['position'], $scriptParams['htmlOptions']); } $output = '<head></head>'; $this->_clientScript->render($output); $this->assertEquals($expectedScriptTagCount, substr_count($output, '<script')); }