Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
createNotFoundException example
$response
=
$controller
->
redirect
(
'https://dunglas.fr', 301
)
;
$this
->
assertInstanceOf
(
RedirectResponse::
class
,
$response
)
;
$this
->
assertSame
(
'https://dunglas.fr',
$response
->
getTargetUrl
(
)
)
;
$this
->
assertSame
(
301,
$response
->
getStatusCode
(
)
)
;
}
public
function
testCreateNotFoundException
(
)
{
$controller
=
$this
->
createController
(
)
;
$this
->
assertInstanceOf
(
NotFoundHttpException::
class
,
$controller
->
createNotFoundException
(
)
)
;
}
public
function
testCreateForm
(
)
{
$config
=
$this
->
createMock
(
FormConfigInterface::
class
)
;
$config
->
method
(
'getInheritData'
)
->
willReturn
(
false
)
;
$config
->
method
(
'getName'
)
->
willReturn
(
''
)
;
$form
=
new
Form
(
$config
)
;
$formFactory
=
$this
->
createMock
(
FormFactoryInterface::
class
)
;
$this
->factories =
$factories
;
}
public
function
has
(
string
$id
)
: bool
{
return
isset
(
$this
->factories
[
$id
]
)
;
}
public
function
get
(
string
$id
)
: mixed
{
if
(
!
isset
(
$this
->factories
[
$id
]
)
)
{
throw
$this
->
createNotFoundException
(
$id
)
;
}
if
(
isset
(
$this
->loading
[
$id
]
)
)
{
$ids
=
array_values
(
$this
->loading
)
;
$ids
= \
array_slice
(
$this
->loading,
array_search
(
$id
,
$ids
)
)
;
$ids
[
]
=
$id
;
throw
$this
->
createCircularReferenceException
(
$id
,
$ids
)
;
}
$this
->loading
[
$id
]
=
$id
;
$this
->factories =
$factories
;
}
public
function
has
(
string
$id
)
: bool
{
return
isset
(
$this
->factories
[
$id
]
)
;
}
public
function
get
(
string
$id
)
: mixed
{
if
(
!
isset
(
$this
->factories
[
$id
]
)
)
{
throw
$this
->
createNotFoundException
(
$id
)
;
}
if
(
isset
(
$this
->loading
[
$id
]
)
)
{
$ids
=
array_values
(
$this
->loading
)
;
$ids
= \
array_slice
(
$this
->loading,
array_search
(
$id
,
$ids
)
)
;
$ids
[
]
=
$id
;
throw
$this
->
createCircularReferenceException
(
$id
,
$ids
)
;
}
$this
->loading
[
$id
]
=
$id
;