Test Assets::resetJs() and Assets::resetCss()

Also fix closing parentheses. Added PHPDoc
This commit is contained in:
Flavio Copes
2016-01-27 10:51:04 +01:00
parent 7ab75811ad
commit dec78b9cbd

View File

@@ -2,6 +2,9 @@
use Codeception\Util\Fixtures;
/**
* Class AssetsTest
*/
class AssetsTest extends \Codeception\TestCase\Test
{
/**
@@ -329,7 +332,9 @@ class AssetsTest extends \Codeception\TestCase\Test
$assets->reset();
$assets->addInlineJs('alert("test")');
$js = $assets->js();
$this->assertSame($js, PHP_EOL. '<script>' .PHP_EOL . 'alert("test")' . PHP_EOL.PHP_EOL .'</script>' . PHP_EOL);
$this->assertSame($js,
PHP_EOL . '<script>' . PHP_EOL . 'alert("test")' . PHP_EOL . PHP_EOL . '</script>' . PHP_EOL);
}
public function testGetCollections()
{
@@ -380,4 +385,35 @@ class AssetsTest extends \Codeception\TestCase\Test
$this->assertTrue(count($assets->css()) == 0);
}
public function testResetJs()
{
$assets = $this->assets();
$assets->addInlineJs('alert("test")');
$assets->resetJs();
$this->assertTrue(count($assets->js()) == 0);
$assets->addAsyncJs('jquery');
$assets->resetJs();
$this->assertTrue(count($assets->js()) == 0);
}
public function testResetCss()
{
$assets = $this->assets();
$this->assertTrue(count($assets->js()) == 0);
$assets->addInlineCss('body { color: black }');
$assets->resetCss();
$this->assertTrue(count($assets->css()) == 0);
$assets->add('/system/assets/debugger.css', null, true);
$assets->resetCss();
$this->assertTrue(count($assets->css()) == 0);
}
}