Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
TYPO3
Extensions
lock
Commits
290418fe
Commit
290418fe
authored
Nov 10, 2017
by
Daniel Hürtgen
Browse files
[FEATURE] InvalidConfigurationException for Builder added
parent
1ee2d466
Changes
2
Hide whitespace changes
Inline
Side-by-side
Classes/Builder/Exception/InvalidConfigurationException.php
0 → 100644
View file @
290418fe
<?php
namespace
Higidi\Lock\Builder\Exception
;
/**
* Thrown on any invalid configuration within the builder.
*/
class
InvalidConfigurationException
extends
\
Exception
{
/**
* @var array
*/
protected
$configuration
;
/**
* Construct the exception. Note: The message is NOT binary safe.
*
* @link http://php.net/manual/en/exception.construct.php
*
* @param array $configuration The invalid configuration array
* @param string $message [optional] The Exception message to throw.
* @param int $code [optional] The Exception code.
* @param \Exception $previous [optional] The previous throwable used for the exception chaining.
*
* @since 5.1.0
*/
public
function
__construct
(
array
$configuration
,
$message
=
""
,
$code
=
0
,
\
Exception
$previous
=
null
)
{
parent
::
__construct
(
$message
,
$code
,
$previous
);
$this
->
configuration
=
$configuration
;
}
/**
* Returns the configuration.
*
* @return array The configuration array
*/
public
function
getConfiguration
()
{
return
$this
->
configuration
;
}
}
Tests/Unit/Builder/Exception/InvalidConfigurationExceptionTest.php
0 → 100644
View file @
290418fe
<?php
namespace
Higidi\Lock\Tests\Unit\Builder\Exception
;
use
Higidi\Lock\Builder\Exception\InvalidConfigurationException
;
use
Nimut\TestingFramework\TestCase\UnitTestCase
;
/**
* Test case for "\Higidi\Lock\Builder\Exception\InvalidConfigurationException".
*
* @covers \Higidi\Lock\Builder\Exception\InvalidConfigurationException
*/
class
InvalidConfigurationExceptionTest
extends
UnitTestCase
{
/**
* @test
*/
public
function
itExtendsTheGenericException
()
{
$sut
=
new
InvalidConfigurationException
([]);
$this
->
assertInstanceOf
(
\
Exception
::
class
,
$sut
);
}
/**
* @test
*/
public
function
itHoldsTheConfiguration
()
{
$configuration
=
[
'bla'
=>
'foo'
,
];
$sut
=
new
InvalidConfigurationException
(
$configuration
);
$this
->
assertSame
(
$configuration
,
$sut
->
getConfiguration
());
}
}
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