Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
MinimalQuickViewPage example
->
addAssociation
(
'options.group'
)
->
addAssociation
(
'properties.group'
)
->
addAssociation
(
'mainCategories.category'
)
;
$criteria
->
getAssociation
(
'media'
)
->
addSorting
(
new
FieldSorting
(
'position'
)
)
;
$result
=
$this
->productRoute->
load
(
$productId
,
new
Request
(
)
,
$salesChannelContext
,
$criteria
)
;
$product
=
$result
->
getProduct
(
)
;
$page
=
new
MinimalQuickViewPage
(
$product
)
;
$event
=
new
MinimalQuickViewPageLoadedEvent
(
$page
,
$salesChannelContext
,
$request
)
;
$this
->eventDispatcher->
dispatch
(
$event
)
;
return
$page
;
}
}
$response
=
$this
->controller->
switch
(
$ids
->
get
(
'product'
)
,
new
Request
(
)
,
$this
->
createMock
(
SalesChannelContext::
class
)
)
;
static
::
assertEquals
(
'{"url":"","productId":"' .
$ids
->
get
(
'product'
)
. '"}',
$response
->
getContent
(
)
)
;
}
public
function
testQuickViewMinimal
(
)
: void
{
$ids
=
new
IdsCollection
(
)
;
$request
=
new
Request
(
[
'productId' =>
$ids
->
get
(
'productId'
)
]
)
;
$this
->minimalQuickViewPageLoaderMock->
method
(
'load'
)
->
with
(
$request
)
->
willReturn
(
new
MinimalQuickViewPage
(
new
ProductEntity
(
)
)
)
;
$response
=
$this
->controller->
quickviewMinimal
(
$request
,
$this
->
createMock
(
SalesChannelContext::
class
)
)
;
static
::
assertEquals
(
Response::HTTP_OK,
$response
->
getStatusCode
(
)
)
;
static
::
assertInstanceOf
(
MinimalQuickViewPage::
class
,
$this
->controller->renderStorefrontParameters
[
'page'
]
)
;
static
::
assertInstanceOf
(
ProductQuickViewWidgetLoadedHook::
class
,
$this
->controller->calledHook
)
;
}