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
d82a3f41
Commit
d82a3f41
authored
Sep 07, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added asset dependency tests.
parent
ed9e04db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
3 deletions
+40
-3
AssetTest.php
tests/AssetTest.php
+40
-3
No files found.
tests/AssetTest.php
View file @
d82a3f41
...
@@ -20,7 +20,7 @@ class AssetTest extends PHPUnit_Framework_TestCase {
...
@@ -20,7 +20,7 @@ class AssetTest extends PHPUnit_Framework_TestCase {
$mock
=
$this
->
getMockBuilder
(
'Laravel\\Asset_Container'
)
->
disableOriginalConstructor
()
->
getMock
();
$mock
=
$this
->
getMockBuilder
(
'Laravel\\Asset_Container'
)
->
disableOriginalConstructor
()
->
getMock
();
$mock
->
expects
(
$this
->
any
())
->
method
(
'styles'
)
->
will
(
$this
->
returnValue
(
'styles'
));
$mock
->
expects
(
$this
->
any
())
->
method
(
'styles'
)
->
will
(
$this
->
returnValue
(
'styles'
));
$asset
->
containers
[
'default'
]
=
$mock
;
$asset
->
containers
[
'default'
]
=
$mock
;
$this
->
assertEquals
(
$asset
->
styles
(),
'styles'
);
$this
->
assertEquals
(
$asset
->
styles
(),
'styles'
);
...
@@ -63,7 +63,7 @@ class AssetTest extends PHPUnit_Framework_TestCase {
...
@@ -63,7 +63,7 @@ class AssetTest extends PHPUnit_Framework_TestCase {
);
);
}
}
public
function
test
StylesCanBeRetrieve
d
()
public
function
test
AllStylesCanBeRetrievedViaStylesMetho
d
()
{
{
$container
=
new
Laravel\Asset_Container
(
'default'
,
new
HTMLAssetStub
);
$container
=
new
Laravel\Asset_Container
(
'default'
,
new
HTMLAssetStub
);
...
@@ -74,7 +74,7 @@ class AssetTest extends PHPUnit_Framework_TestCase {
...
@@ -74,7 +74,7 @@ class AssetTest extends PHPUnit_Framework_TestCase {
$this
->
assertEquals
(
$container
->
styles
(),
'css/reset.css media:allcss/jquery.css media:all'
);
$this
->
assertEquals
(
$container
->
styles
(),
'css/reset.css media:allcss/jquery.css media:all'
);
}
}
public
function
test
ScriptsCanBeRetrieve
d
()
public
function
test
AllScriptsCanBeRetrievedViaScriptsMetho
d
()
{
{
$container
=
new
Laravel\Asset_Container
(
'default'
,
new
HTMLAssetStub
);
$container
=
new
Laravel\Asset_Container
(
'default'
,
new
HTMLAssetStub
);
...
@@ -85,6 +85,43 @@ class AssetTest extends PHPUnit_Framework_TestCase {
...
@@ -85,6 +85,43 @@ class AssetTest extends PHPUnit_Framework_TestCase {
$this
->
assertEquals
(
$container
->
scripts
(),
'js/jquery-ui.js js/jquery.js test:value'
);
$this
->
assertEquals
(
$container
->
scripts
(),
'js/jquery-ui.js js/jquery.js test:value'
);
}
}
public
function
testAssetsAreSortedBasedOnDependencies
()
{
$container
=
$this
->
getContainer
();
$container
->
script
(
'jquery'
,
'js/jquery.js'
,
array
(
'jquery-ui'
));
$container
->
script
(
'jquery-ui'
,
'js/jquery-ui.js'
);
$scripts
=
$container
->
scripts
();
$this
->
assertTrue
(
strpos
(
$scripts
,
'js/jquery-ui.js'
)
<
strpos
(
$scripts
,
'js/jquery.js'
));
}
/**
* @expectedException Exception
*/
public
function
testAssetsCannotBeDependentOnSelf
()
{
$container
=
$this
->
getContainer
();
$container
->
script
(
'jquery'
,
'js/jquery.js'
,
array
(
'jquery'
));
$container
->
scripts
();
}
/**
* @expectedException Exception
*/
public
function
testAssetDependenciesCannotBeCircular
()
{
$container
=
$this
->
getContainer
();
$container
->
script
(
'jquery'
,
'js/jquery.js'
,
array
(
'jquery-ui'
));
$container
->
script
(
'jquery-ui'
,
'js/jquery-ui.js'
,
array
(
'jquery'
));
$container
->
scripts
();
}
private
function
getContainer
()
private
function
getContainer
()
{
{
return
new
Laravel\Asset_Container
(
'default'
,
Laravel\IoC
::
resolve
(
'laravel.html'
));
return
new
Laravel\Asset_Container
(
'default'
,
Laravel\IoC
::
resolve
(
'laravel.html'
));
...
...
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