Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
9977ccb7
Commit
9977ccb7
authored
Jan 18, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding asset container tests.
parent
ebb11b97
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
132 additions
and
0 deletions
+132
-0
asset.test.php
tests/cases/laravel/asset.test.php
+132
-0
No files found.
tests/cases/laravel/asset.test.php
0 → 100644
View file @
9977ccb7
<?php
class
AssetTest
extends
PHPUnit_Framework_TestCase
{
/**
* Initialize the test environment.
*/
public
function
setUp
()
{
Asset
::
$containers
=
array
();
}
/**
* Test the Asset::container method.
*
* @group laravel
*/
public
function
testContainersCanBeCreated
()
{
$container
=
Asset
::
container
(
'foo'
);
$this
->
assertTrue
(
$container
===
Asset
::
container
(
'foo'
));
$this
->
assertInstanceOf
(
'\\Laravel\\Asset_Container'
,
$container
);
}
/**
* Test the Asset::container method for default container creation.
*
* @group laravel
*/
public
function
testDefaultContainerCreatedByDefault
()
{
$this
->
assertEquals
(
'default'
,
Asset
::
container
()
->
name
);
}
/**
* Test the Asset::__callStatic method.
*
* @group laravel
*/
public
function
testContainerMethodsCanBeDynamicallyCalled
()
{
Asset
::
style
(
'common'
,
'common.css'
);
$this
->
assertEquals
(
'common.css'
,
Asset
::
container
()
->
assets
[
'style'
][
'common'
][
'source'
]);
}
/**
* Test the Asset_Container constructor.
*
* @group laravel
*/
public
function
testNameIsSetOnAssetContainerConstruction
()
{
$container
=
new
Laravel\Asset_Container
(
'foo'
);
$this
->
assertEquals
(
'foo'
,
$container
->
name
);
}
/**
* Test the Asset_Container::add method.
*
* @group laravel
*/
public
function
testAddMethodProperlySniffsAssetType
()
{
$container
=
new
Laravel\Asset_Container
(
'foo'
);
$container
->
add
(
'jquery'
,
'jquery.js'
);
$container
->
add
(
'common'
,
'common.css'
);
$this
->
assertEquals
(
'jquery.js'
,
$container
->
assets
[
'script'
][
'jquery'
][
'source'
]);
$this
->
assertEquals
(
'common.css'
,
$container
->
assets
[
'style'
][
'common'
][
'source'
]);
}
/**
* Test the Asset_Container::style method.
*
* @group laravel
*/
public
function
testStyleMethodProperlyRegistersAnAsset
()
{
$container
=
new
Laravel\Asset_Container
(
'foo'
);
$container
->
style
(
'common'
,
'common.css'
);
$this
->
assertEquals
(
'common.css'
,
$container
->
assets
[
'style'
][
'common'
][
'source'
]);
}
/**
* Test the Asset_Container::style method sets media attribute.
*
* @group laravel
*/
public
function
testStyleMethodProperlySetsMediaAttributeIfNotSet
()
{
$container
=
new
Laravel\Asset_Container
(
'foo'
);
$container
->
style
(
'common'
,
'common.css'
);
$this
->
assertEquals
(
'all'
,
$container
->
assets
[
'style'
][
'common'
][
'attributes'
][
'media'
]);
}
/**
* Test the Asset_Container::style method sets media attribute.
*
* @group laravel
*/
public
function
testStyleMethodProperlyIgnoresMediaAttributeIfSet
()
{
$container
=
new
Laravel\Asset_Container
(
'foo'
);
$container
->
style
(
'common'
,
'common.css'
,
array
(),
array
(
'media'
=>
'print'
));
$this
->
assertEquals
(
'print'
,
$container
->
assets
[
'style'
][
'common'
][
'attributes'
][
'media'
]);
}
/**
* Test the Asset_Container::script method.
*
* @group laravel
*/
public
function
testScriptMethodProperlyRegistersAnAsset
()
{
$container
=
new
Laravel\Asset_Container
(
'foo'
);
$container
->
script
(
'jquery'
,
'jquery.js'
);
$this
->
assertEquals
(
'jquery.js'
,
$container
->
assets
[
'script'
][
'jquery'
][
'source'
]);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment