Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
ab55e18f
Commit
ab55e18f
authored
Apr 18, 2011
by
Igor Wiedler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[mount] check for invalid appPath in LazyApplication
parent
d7c280e9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
src/Silex/LazyApplication.php
src/Silex/LazyApplication.php
+4
-0
tests/Silex/Tests/FunctionalTest.php
tests/Silex/Tests/FunctionalTest.php
+17
-0
No files found.
src/Silex/LazyApplication.php
View file @
ab55e18f
...
@@ -45,6 +45,10 @@ class LazyApplication
...
@@ -45,6 +45,10 @@ class LazyApplication
$this
->
app
=
require
$this
->
appPath
;
$this
->
app
=
require
$this
->
appPath
;
}
}
if
(
!
$this
->
app
instanceof
Application
)
{
throw
new
\InvalidArgumentException
(
'The provided path did not return a Silex\Application on inclusion.'
);
}
return
$this
->
app
;
return
$this
->
app
;
}
}
}
}
tests/Silex/Tests/FunctionalTest.php
View file @
ab55e18f
...
@@ -109,4 +109,21 @@ EOF
...
@@ -109,4 +109,21 @@ EOF
unlink
(
$tmp
);
unlink
(
$tmp
);
}
}
public
function
testLazyMountWithAnInvalidExternalFile
()
{
$tmp
=
sys_get_temp_dir
()
.
'/SilexInvalidLazyApp.php'
;
file_put_contents
(
$tmp
,
''
);
$mounted
=
new
LazyApplication
(
$tmp
);
$app
=
new
Application
();
$app
->
mount
(
'/hello'
,
$mounted
);
try
{
$app
->
handle
(
Request
::
create
(
'/hello/Silex'
));
$this
->
fail
(
'Invalid LazyApplications should throw an exception.'
);
}
catch
(
\InvalidArgumentException
$e
)
{
}
}
}
}
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