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
47818321
Commit
47818321
authored
Sep 23, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #92 from wGEric/develop
Fixing bootstrap file for tests and updating ConfigTest
parents
938c6f4d
71d300f7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
51 deletions
+20
-51
ConfigTest.php
tests/ConfigTest.php
+19
-50
bootstrap.php
tests/bootstrap.php
+1
-1
No files found.
tests/ConfigTest.php
View file @
47818321
...
...
@@ -2,73 +2,42 @@
class
ConfigTest
extends
PHPUnit_Framework_TestCase
{
public
static
function
setUpBeforeClas
s
()
public
function
testHasMethodReturnsTrueWhenItemExist
s
()
{
IoC
::
container
()
->
singletons
=
array
();
}
public
function
tearDown
()
{
IoC
::
container
()
->
singletons
=
array
();
}
/**
* @dataProvider getGetMocker
*/
public
function
testHasMethodReturnsTrueWhenItemExists
(
$mock
,
$mocker
)
{
$mocker
->
will
(
$this
->
returnValue
(
'value'
));
$this
->
assertTrue
(
$mock
->
has
(
'something'
));
}
/**
* @dataProvider getGetMocker
*/
public
function
testHasMethodReturnsFalseWhenItemDoesntExist
(
$mock
,
$mocker
)
{
$mocker
->
will
(
$this
->
returnValue
(
null
));
Config
::
set
(
'hasvalue'
,
true
);
$this
->
assert
False
(
$mock
->
has
(
'something
'
));
$this
->
assert
True
(
Config
::
has
(
'hasvalue
'
));
}
public
function
getGetMocker
()
public
function
testHasMethodReturnsFalseWhenItemDoesntExist
()
{
$mock
=
$this
->
getMock
(
'Laravel\\Config'
,
array
(
'get'
),
array
(
null
));
return
array
(
array
(
$mock
,
$mock
->
expects
(
$this
->
any
())
->
method
(
'get'
)));
$this
->
assertFalse
(
Config
::
has
(
'something'
));
}
public
function
testConfigClassCanRetrieveItems
()
{
$config
=
IoC
::
container
()
->
resolve
(
'laravel.config'
);
$this
->
assertTrue
(
is_array
(
$config
->
get
(
'application'
)));
$this
->
assertEquals
(
$config
->
get
(
'application.url'
),
'http://localhost'
);
$this
->
assertTrue
(
is_array
(
Config
::
get
(
'application'
)));
$this
->
assertEquals
(
Config
::
get
(
'application.url'
),
'http://localhost'
);
}
public
function
testGetMethodReturnsDefaultWhenItemDoesntExist
()
{
$config
=
IoC
::
container
()
->
resolve
(
'laravel.config'
);
$this
->
assertNull
(
$config
->
get
(
'config.item'
));
$this
->
assertEquals
(
$config
->
get
(
'config.item'
,
'test'
),
'test'
);
$this
->
assertEquals
(
$config
->
get
(
'config.item'
,
function
()
{
return
'test'
;}),
'test'
);
$this
->
assertNull
(
Config
::
get
(
'config.item'
));
$this
->
assertEquals
(
Config
::
get
(
'config.item'
,
'test'
),
'test'
);
$this
->
assertEquals
(
Config
::
get
(
'config.item'
,
function
()
{
return
'test'
;}),
'test'
);
}
public
function
testConfigClassCanSetItems
()
{
$config
=
IoC
::
container
()
->
resolve
(
'laravel.config'
);
$config
->
set
(
'application.names.test'
,
'test'
);
$config
->
set
(
'application.url'
,
'test'
);
$config
->
set
(
'session'
,
array
());
$config
->
set
(
'test'
,
array
());
Config
::
set
(
'application.names.test'
,
'test'
);
Config
::
set
(
'application.url'
,
'test'
);
Config
::
set
(
'session'
,
array
());
Config
::
set
(
'test'
,
array
());
$this
->
assertEquals
(
$config
->
get
(
'application.names.test'
),
'test'
);
$this
->
assertEquals
(
$config
->
get
(
'application.url'
),
'test'
);
$this
->
assertEquals
(
$config
->
get
(
'session'
),
array
());
$this
->
assertEquals
(
$config
->
get
(
'test'
),
array
());
$this
->
assertEquals
(
Config
::
get
(
'application.names.test'
),
'test'
);
$this
->
assertEquals
(
Config
::
get
(
'application.url'
),
'test'
);
$this
->
assertEquals
(
Config
::
get
(
'session'
),
array
());
$this
->
assertEquals
(
Config
::
get
(
'test'
),
array
());
}
}
\ No newline at end of file
tests/bootstrap.php
View file @
47818321
...
...
@@ -23,4 +23,4 @@ $storage = 'storage';
$public
=
'public'
;
require
realpath
(
$laravel
)
.
'/core.php'
;
\ No newline at end of file
require
realpath
(
$laravel
)
.
'/bootstrap/core.php'
;
\ 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