Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace Iulyanp\ElixirMixBundle\Tests\Twig; | ||
|
||
use Iulyanp\ElixirMixBundle\Twig\MixExtension; | ||
|
||
/** | ||
* Class Test | ||
*/ | ||
class ElixirMixExtensionTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
const WEB_DIR = __DIR__.'/stub'; | ||
|
||
/** | ||
* @var | ||
*/ | ||
private $mixExtension; | ||
|
||
/** | ||
* Set UP. | ||
* | ||
* Instantiate ElixirExtension for all tests | ||
*/ | ||
public function setUp() | ||
{ | ||
$this->mixExtension = new MixExtension(self::WEB_DIR); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function mixFunctionReturnManifest() | ||
{ | ||
$this->assertEquals( | ||
'css/app-db9165hf67.css', | ||
$this->mixExtension->mix('app.css') | ||
); | ||
$this->assertEquals( | ||
'css/index-9rt53c9u67.css', | ||
$this->mixExtension->mix('index.css') | ||
); | ||
$this->assertEquals( | ||
'js/app-db9183c967.js', | ||
$this->mixExtension->mix('app.js') | ||
); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function elixirFunctionThrowsErrorWhenFileNotExists() | ||
{ | ||
$this->expectException('\Exception'); | ||
$this->expectExceptionMessage('The "css/not_existing.css" key could not be found in the manifest file. '. | ||
'Please pass just the asset filename as a parameter to the mix() method.'); | ||
$this->mixExtension->mix('css/not_existing.css'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"app.css": "css/app-db9165hf67.css", | ||
"index.css": "css/index-9rt53c9u67.css", | ||
"app.js": "js/app-db9183c967.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit | ||
backupStaticAttributes="false" | ||
|
||
cacheTokens="false" | ||
colors="false" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
forceCoversAnnotation="false" | ||
mapTestClassNameToCoveredClassName="false" | ||
printerClass="PHPUnit_TextUI_ResultPrinter" | ||
|
||
processIsolation="false" | ||
stopOnError="false" | ||
stopOnFailure="false" | ||
stopOnIncomplete="false" | ||
stopOnSkipped="false" | ||
testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader" | ||
|
||
strict="false" | ||
verbose="false" | ||
> | ||
|
||
<testsuites> | ||
<testsuite name="AllTests"> | ||
<directory>Tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<filter> | ||
<blacklist> | ||
<directory suffix=".php"></directory> | ||
<file></file> | ||
<exclude> | ||
<directory suffix=".php"></directory> | ||
<file></file> | ||
</exclude> | ||
</blacklist> | ||
<whitelist processUncoveredFilesFromWhitelist="true"> | ||
<directory suffix=".php"></directory> | ||
<file></file> | ||
<exclude> | ||
<directory suffix=".php"></directory> | ||
<file></file> | ||
</exclude> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |