@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 69 | 69 | * @return string HTML code |
| 70 | 70 | */ |
| 71 | - public function getBody( string $uid = '' ) : string |
|
| 71 | + public function getBody(string $uid = '') : string |
|
| 72 | 72 | { |
| 73 | 73 | $prefixes = ['path']; |
| 74 | 74 | $context = $this->getContext(); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | $confkey = 'client/html/cms/page'; |
| 102 | 102 | |
| 103 | - if( ( $html = $this->getCached( 'body', $uid, $prefixes, $confkey ) ) === null ) |
|
| 103 | + if (($html = $this->getCached('body', $uid, $prefixes, $confkey)) === null) |
|
| 104 | 104 | { |
| 105 | 105 | $view = $this->getView(); |
| 106 | 106 | |
@@ -131,47 +131,47 @@ discard block |
||
| 131 | 131 | { |
| 132 | 132 | $html = ''; |
| 133 | 133 | |
| 134 | - if( !isset( $this->view ) ) { |
|
| 135 | - $view = $this->view = $this->getObject()->addData( $view, $this->tags, $this->expire ); |
|
| 134 | + if (!isset($this->view)) { |
|
| 135 | + $view = $this->view = $this->getObject()->addData($view, $this->tags, $this->expire); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 139 | - $html .= $subclient->setView( $view )->getBody( $uid ); |
|
| 138 | + foreach ($this->getSubClients() as $subclient) { |
|
| 139 | + $html .= $subclient->setView($view)->getBody($uid); |
|
| 140 | 140 | } |
| 141 | 141 | $view->pageBody = $html; |
| 142 | 142 | |
| 143 | - $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 144 | - $this->setCached( 'body', $uid, $prefixes, $confkey, $html, $this->tags, $this->expire ); |
|
| 143 | + $html = $view->render($view->config($tplconf, $default)); |
|
| 144 | + $this->setCached('body', $uid, $prefixes, $confkey, $html, $this->tags, $this->expire); |
|
| 145 | 145 | |
| 146 | 146 | return $html; |
| 147 | 147 | } |
| 148 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 148 | + catch (\Aimeos\Client\Html\Exception $e) |
|
| 149 | 149 | { |
| 150 | - $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 151 | - $view->pageErrorList = array_merge( $view->get( 'pageErrorList', [] ), $error ); |
|
| 150 | + $error = array($context->getI18n()->dt('client', $e->getMessage())); |
|
| 151 | + $view->pageErrorList = array_merge($view->get('pageErrorList', []), $error); |
|
| 152 | 152 | } |
| 153 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 153 | + catch (\Aimeos\Controller\Frontend\Exception $e) |
|
| 154 | 154 | { |
| 155 | - $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 156 | - $view->pageErrorList = array_merge( $view->get( 'pageErrorList', [] ), $error ); |
|
| 155 | + $error = array($context->getI18n()->dt('controller/frontend', $e->getMessage())); |
|
| 156 | + $view->pageErrorList = array_merge($view->get('pageErrorList', []), $error); |
|
| 157 | 157 | } |
| 158 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 158 | + catch (\Aimeos\MShop\Exception $e) |
|
| 159 | 159 | { |
| 160 | - $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 161 | - $view->pageErrorList = array_merge( $view->get( 'pageErrorList', [] ), $error ); |
|
| 160 | + $error = array($context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 161 | + $view->pageErrorList = array_merge($view->get('pageErrorList', []), $error); |
|
| 162 | 162 | } |
| 163 | - catch( \Exception $e ) |
|
| 163 | + catch (\Exception $e) |
|
| 164 | 164 | { |
| 165 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 166 | - $view->pageErrorList = array_merge( $view->get( 'pageErrorList', [] ), $error ); |
|
| 167 | - $this->logException( $e ); |
|
| 165 | + $error = array($context->getI18n()->dt('client', 'A non-recoverable error occured')); |
|
| 166 | + $view->pageErrorList = array_merge($view->get('pageErrorList', []), $error); |
|
| 167 | + $this->logException($e); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 170 | + $html = $view->render($view->config($tplconf, $default)); |
|
| 171 | 171 | } |
| 172 | 172 | else |
| 173 | 173 | { |
| 174 | - $html = $this->modifyBody( $html, $uid ); |
|
| 174 | + $html = $this->modifyBody($html, $uid); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | return $html; |
@@ -184,12 +184,12 @@ discard block |
||
| 184 | 184 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 185 | 185 | * @return string|null String including HTML tags for the header on error |
| 186 | 186 | */ |
| 187 | - public function getHeader( string $uid = '' ) : ?string |
|
| 187 | + public function getHeader(string $uid = '') : ?string |
|
| 188 | 188 | { |
| 189 | 189 | $prefixes = ['page']; |
| 190 | 190 | $confkey = 'client/html/cms/page'; |
| 191 | 191 | |
| 192 | - if( ( $html = $this->getCached( 'header', $uid, $prefixes, $confkey ) ) === null ) |
|
| 192 | + if (($html = $this->getCached('header', $uid, $prefixes, $confkey)) === null) |
|
| 193 | 193 | { |
| 194 | 194 | $view = $this->getView(); |
| 195 | 195 | |
@@ -221,28 +221,28 @@ discard block |
||
| 221 | 221 | { |
| 222 | 222 | $html = ''; |
| 223 | 223 | |
| 224 | - if( !isset( $this->view ) ) { |
|
| 225 | - $view = $this->view = $this->getObject()->addData( $view, $this->tags, $this->expire ); |
|
| 224 | + if (!isset($this->view)) { |
|
| 225 | + $view = $this->view = $this->getObject()->addData($view, $this->tags, $this->expire); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 229 | - $html .= $subclient->setView( $view )->getHeader( $uid ); |
|
| 228 | + foreach ($this->getSubClients() as $subclient) { |
|
| 229 | + $html .= $subclient->setView($view)->getHeader($uid); |
|
| 230 | 230 | } |
| 231 | 231 | $view->pageHeader = $html; |
| 232 | 232 | |
| 233 | - $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 234 | - $this->setCached( 'header', $uid, $prefixes, $confkey, $html, $this->tags, $this->expire ); |
|
| 233 | + $html = $view->render($view->config($tplconf, $default)); |
|
| 234 | + $this->setCached('header', $uid, $prefixes, $confkey, $html, $this->tags, $this->expire); |
|
| 235 | 235 | |
| 236 | 236 | return $html; |
| 237 | 237 | } |
| 238 | - catch( \Exception $e ) |
|
| 238 | + catch (\Exception $e) |
|
| 239 | 239 | { |
| 240 | - $this->logException( $e ); |
|
| 240 | + $this->logException($e); |
|
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | else |
| 244 | 244 | { |
| 245 | - $html = $this->modifyHeader( $html, $uid ); |
|
| 245 | + $html = $this->modifyHeader($html, $uid); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | return $html; |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * @param string|null $name Name of the sub-client (Default if null) |
| 257 | 257 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 258 | 258 | */ |
| 259 | - public function getSubClient( string $type, string $name = null ) : \Aimeos\Client\Html\Iface |
|
| 259 | + public function getSubClient(string $type, string $name = null) : \Aimeos\Client\Html\Iface |
|
| 260 | 260 | { |
| 261 | 261 | /** client/html/cms/page/decorators/excludes |
| 262 | 262 | * Excludes decorators added by the "common" option from the cms page html client |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | * @see client/html/cms/page/decorators/excludes |
| 332 | 332 | * @see client/html/cms/page/decorators/global |
| 333 | 333 | */ |
| 334 | - return $this->createSubClient( 'cms/page/' . $type, $name ); |
|
| 334 | + return $this->createSubClient('cms/page/' . $type, $name); |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | |
@@ -350,26 +350,26 @@ discard block |
||
| 350 | 350 | { |
| 351 | 351 | parent::process(); |
| 352 | 352 | } |
| 353 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 353 | + catch (\Aimeos\Client\Html\Exception $e) |
|
| 354 | 354 | { |
| 355 | - $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 356 | - $view->pageErrorList = array_merge( $view->get( 'pageErrorList', [] ), $error ); |
|
| 355 | + $error = array($context->getI18n()->dt('client', $e->getMessage())); |
|
| 356 | + $view->pageErrorList = array_merge($view->get('pageErrorList', []), $error); |
|
| 357 | 357 | } |
| 358 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 358 | + catch (\Aimeos\Controller\Frontend\Exception $e) |
|
| 359 | 359 | { |
| 360 | - $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 361 | - $view->pageErrorList = array_merge( $view->get( 'pageErrorList', [] ), $error ); |
|
| 360 | + $error = array($context->getI18n()->dt('controller/frontend', $e->getMessage())); |
|
| 361 | + $view->pageErrorList = array_merge($view->get('pageErrorList', []), $error); |
|
| 362 | 362 | } |
| 363 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 363 | + catch (\Aimeos\MShop\Exception $e) |
|
| 364 | 364 | { |
| 365 | - $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 366 | - $view->pageErrorList = array_merge( $view->get( 'pageErrorList', [] ), $error ); |
|
| 365 | + $error = array($context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 366 | + $view->pageErrorList = array_merge($view->get('pageErrorList', []), $error); |
|
| 367 | 367 | } |
| 368 | - catch( \Exception $e ) |
|
| 368 | + catch (\Exception $e) |
|
| 369 | 369 | { |
| 370 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 371 | - $view->pageErrorList = array_merge( $view->get( 'pageErrorList', [] ), $error ); |
|
| 372 | - $this->logException( $e ); |
|
| 370 | + $error = array($context->getI18n()->dt('client', 'A non-recoverable error occured')); |
|
| 371 | + $view->pageErrorList = array_merge($view->get('pageErrorList', []), $error); |
|
| 372 | + $this->logException($e); |
|
| 373 | 373 | } |
| 374 | 374 | } |
| 375 | 375 | |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | */ |
| 382 | 382 | protected function getSubClientNames() : array |
| 383 | 383 | { |
| 384 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 384 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | |
@@ -393,10 +393,10 @@ discard block |
||
| 393 | 393 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 394 | 394 | * @return \Aimeos\MW\View\Iface Modified view object |
| 395 | 395 | */ |
| 396 | - public function addData( \Aimeos\MW\View\Iface $view, array &$tags = [], string &$expire = null ) : \Aimeos\MW\View\Iface |
|
| 396 | + public function addData(\Aimeos\MW\View\Iface $view, array &$tags = [], string &$expire = null) : \Aimeos\MW\View\Iface |
|
| 397 | 397 | { |
| 398 | 398 | $context = $this->getContext(); |
| 399 | - $controller = \Aimeos\Controller\Frontend::create( $context, 'cms' ); |
|
| 399 | + $controller = \Aimeos\Controller\Frontend::create($context, 'cms'); |
|
| 400 | 400 | |
| 401 | 401 | /** client/html/cms/page/domains |
| 402 | 402 | * A list of domain names whose items should be available in the cms page view template |
@@ -411,14 +411,14 @@ discard block |
||
| 411 | 411 | * @param array List of domain names |
| 412 | 412 | * @since 2021.04 |
| 413 | 413 | */ |
| 414 | - $domains = $context->getConfig()->get( 'client/html/cms/page/domains', ['media', 'text'] ); |
|
| 414 | + $domains = $context->getConfig()->get('client/html/cms/page/domains', ['media', 'text']); |
|
| 415 | 415 | |
| 416 | - $page = $controller->uses( $domains )->find( $view->param( 'path', '/' ) ); |
|
| 416 | + $page = $controller->uses($domains)->find($view->param('path', '/')); |
|
| 417 | 417 | |
| 418 | - $this->addMetaItems( $page, $expire, $tags ); |
|
| 418 | + $this->addMetaItems($page, $expire, $tags); |
|
| 419 | 419 | |
| 420 | 420 | $view->pageCmsItem = $page; |
| 421 | 421 | |
| 422 | - return parent::addData( $view, $tags, $expire ); |
|
| 422 | + return parent::addData($view, $tags, $expire); |
|
| 423 | 423 | } |
| 424 | 424 | } |
@@ -7,10 +7,10 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | $enc = $this->encoder(); |
| 9 | 9 | |
| 10 | -$target = $this->config( 'client/html/cms/page/url/target' ); |
|
| 11 | -$cntl = $this->config( 'client/html/cms/page/url/controller', 'cms' ); |
|
| 12 | -$action = $this->config( 'client/html/cms/page/url/action', 'page' ); |
|
| 13 | -$config = $this->config( 'client/html/cms/page/url/config', [] ); |
|
| 10 | +$target = $this->config('client/html/cms/page/url/target'); |
|
| 11 | +$cntl = $this->config('client/html/cms/page/url/controller', 'cms'); |
|
| 12 | +$action = $this->config('client/html/cms/page/url/action', 'page'); |
|
| 13 | +$config = $this->config('client/html/cms/page/url/config', []); |
|
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | /** client/html/cms/page/metatags |
@@ -32,30 +32,30 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | ?> |
| 35 | -<?php if( (bool) $this->config( 'client/html/cms/page/metatags', true ) === true ) : ?> |
|
| 36 | - <?php if( isset( $this->pageCmsItem ) ) : ?> |
|
| 37 | - <title><?= $enc->html( $this->pageCmsItem->getName() ); ?></title> |
|
| 35 | +<?php if ((bool) $this->config('client/html/cms/page/metatags', true) === true) : ?> |
|
| 36 | + <?php if (isset($this->pageCmsItem)) : ?> |
|
| 37 | + <title><?= $enc->html($this->pageCmsItem->getName()); ?></title> |
|
| 38 | 38 | |
| 39 | - <?php foreach( $this->pageCmsItem->getRefItems( 'text', 'meta-keyword', 'default' ) as $textItem ) : ?> |
|
| 40 | - <meta name="keywords" content="<?= $enc->attr( strip_tags( $textItem->getContent() ) ); ?>" /> |
|
| 39 | + <?php foreach ($this->pageCmsItem->getRefItems('text', 'meta-keyword', 'default') as $textItem) : ?> |
|
| 40 | + <meta name="keywords" content="<?= $enc->attr(strip_tags($textItem->getContent())); ?>" /> |
|
| 41 | 41 | <?php endforeach; ?> |
| 42 | 42 | |
| 43 | - <?php foreach( $this->pageCmsItem->getRefItems( 'text', 'meta-description', 'default' ) as $textItem ) : ?> |
|
| 44 | - <meta name="description" content="<?= $enc->attr( strip_tags( $textItem->getContent() ) ); ?>" /> |
|
| 43 | + <?php foreach ($this->pageCmsItem->getRefItems('text', 'meta-description', 'default') as $textItem) : ?> |
|
| 44 | + <meta name="description" content="<?= $enc->attr(strip_tags($textItem->getContent())); ?>" /> |
|
| 45 | 45 | <?php endforeach; ?> |
| 46 | 46 | |
| 47 | - <link rel="canonical" href="<?= $enc->attr( $this->url( $target, $cntl, $action, ['path' => $this->pageCmsItem->getUrl()], $config + ['absoluteUri' => true] ) ); ?>" /> |
|
| 47 | + <link rel="canonical" href="<?= $enc->attr($this->url($target, $cntl, $action, ['path' => $this->pageCmsItem->getUrl()], $config + ['absoluteUri' => true])); ?>" /> |
|
| 48 | 48 | |
| 49 | 49 | <meta property="og:type" content="article" /> |
| 50 | - <meta property="og:title" content="<?= $enc->html( $this->pageCmsItem->getName() ); ?>" /> |
|
| 51 | - <meta property="og:url" content="<?= $enc->attr( $this->url( $target, $cntl, $action, ['path' => $this->pageCmsItem->getUrl()], $config + ['absoluteUri' => true] ) ); ?>" /> |
|
| 50 | + <meta property="og:title" content="<?= $enc->html($this->pageCmsItem->getName()); ?>" /> |
|
| 51 | + <meta property="og:url" content="<?= $enc->attr($this->url($target, $cntl, $action, ['path' => $this->pageCmsItem->getUrl()], $config + ['absoluteUri' => true])); ?>" /> |
|
| 52 | 52 | |
| 53 | - <?php foreach( $this->pageCmsItem->getRefItems( 'text', 'short', 'default' ) as $textItem ) : ?> |
|
| 54 | - <meta property="og:description" content="<?= $enc->attr( $textItem->getContent() ) ?>" /> |
|
| 53 | + <?php foreach ($this->pageCmsItem->getRefItems('text', 'short', 'default') as $textItem) : ?> |
|
| 54 | + <meta property="og:description" content="<?= $enc->attr($textItem->getContent()) ?>" /> |
|
| 55 | 55 | <?php endforeach ?> |
| 56 | 56 | |
| 57 | - <?php foreach( $this->pageCmsItem->getRefItems( 'media', 'default', 'default' ) as $mediaItem ) : ?> |
|
| 58 | - <meta property="og:image" content="<?= $enc->attr( $this->content( $mediaItem->getUrl() ) ) ?>" /> |
|
| 57 | + <?php foreach ($this->pageCmsItem->getRefItems('media', 'default', 'default') as $mediaItem) : ?> |
|
| 58 | + <meta property="og:image" content="<?= $enc->attr($this->content($mediaItem->getUrl())) ?>" /> |
|
| 59 | 59 | <?php endforeach ?> |
| 60 | 60 | |
| 61 | 61 | <meta name="twitter:card" content="summary_large_image" /> |
@@ -65,4 +65,4 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | <?php endif; ?> |
| 67 | 67 | |
| 68 | -<?= $this->get( 'pageHeader' ); ?> |
|
| 68 | +<?= $this->get('pageHeader'); ?> |
|
@@ -14,18 +14,18 @@ |
||
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | ?> |
| 17 | -<section class="aimeos cms-page" data-jsonurl="<?= $enc->attr( $this->link( 'client/jsonapi/url' ) ); ?>"> |
|
| 17 | +<section class="aimeos cms-page" data-jsonurl="<?= $enc->attr($this->link('client/jsonapi/url')); ?>"> |
|
| 18 | 18 | |
| 19 | - <?php if( isset( $this->pageErrorList ) ) : ?> |
|
| 19 | + <?php if (isset($this->pageErrorList)) : ?> |
|
| 20 | 20 | <ul class="error-list"> |
| 21 | - <?php foreach( (array) $this->pageErrorList as $errmsg ) : ?> |
|
| 22 | - <li class="error-item"><?= $enc->html( $errmsg ); ?></li> |
|
| 21 | + <?php foreach ((array) $this->pageErrorList as $errmsg) : ?> |
|
| 22 | + <li class="error-item"><?= $enc->html($errmsg); ?></li> |
|
| 23 | 23 | <?php endforeach; ?> |
| 24 | 24 | </ul> |
| 25 | 25 | <?php endif; ?> |
| 26 | 26 | |
| 27 | - <?php if( isset( $this->pageCmsItem ) ) : ?> |
|
| 28 | - <?php foreach( $this->pageCmsItem->getRefItems( 'text', 'content' ) as $textItem ) : ?> |
|
| 27 | + <?php if (isset($this->pageCmsItem)) : ?> |
|
| 28 | + <?php foreach ($this->pageCmsItem->getRefItems('text', 'content') as $textItem) : ?> |
|
| 29 | 29 | <?= $textItem->getContent() ?> |
| 30 | 30 | <?php endforeach ?> |
| 31 | 31 | <?php endif; ?> |
@@ -22,35 +22,35 @@ |
||
| 22 | 22 | |
| 23 | 23 | protected function tearDown() : void |
| 24 | 24 | { |
| 25 | - unset( $this->context ); |
|
| 25 | + unset($this->context); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | public function testCreateClient() |
| 30 | 30 | { |
| 31 | - $client = \Aimeos\Client\Html\Cms\Page\Factory::create( $this->context ); |
|
| 32 | - $this->assertInstanceOf( '\\Aimeos\\Client\\Html\\Iface', $client ); |
|
| 31 | + $client = \Aimeos\Client\Html\Cms\Page\Factory::create($this->context); |
|
| 32 | + $this->assertInstanceOf('\\Aimeos\\Client\\Html\\Iface', $client); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | public function testCreateClientName() |
| 37 | 37 | { |
| 38 | - $client = \Aimeos\Client\Html\Cms\Page\Factory::create( $this->context, 'Standard' ); |
|
| 39 | - $this->assertInstanceOf( '\\Aimeos\\Client\\Html\\Iface', $client ); |
|
| 38 | + $client = \Aimeos\Client\Html\Cms\Page\Factory::create($this->context, 'Standard'); |
|
| 39 | + $this->assertInstanceOf('\\Aimeos\\Client\\Html\\Iface', $client); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | public function testCreateClientNameInvalid() |
| 44 | 44 | { |
| 45 | - $this->expectException( '\\Aimeos\\Client\\Html\\Exception' ); |
|
| 46 | - \Aimeos\Client\Html\Cms\Page\Factory::create( $this->context, '$$$' ); |
|
| 45 | + $this->expectException('\\Aimeos\\Client\\Html\\Exception'); |
|
| 46 | + \Aimeos\Client\Html\Cms\Page\Factory::create($this->context, '$$$'); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | public function testCreateClientNameNotFound() |
| 51 | 51 | { |
| 52 | - $this->expectException( '\\Aimeos\\Client\\Html\\Exception' ); |
|
| 53 | - \Aimeos\Client\Html\Cms\Page\Factory::create( $this->context, 'notfound' ); |
|
| 52 | + $this->expectException('\\Aimeos\\Client\\Html\\Exception'); |
|
| 53 | + \Aimeos\Client\Html\Cms\Page\Factory::create($this->context, 'notfound'); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | } |
@@ -18,50 +18,50 @@ discard block |
||
| 18 | 18 | protected function setUp() : void |
| 19 | 19 | { |
| 20 | 20 | $this->context = \TestHelperHtml::getContext(); |
| 21 | - $this->context->getLocale()->setLanguageId( 'en' ); |
|
| 21 | + $this->context->getLocale()->setLanguageId('en'); |
|
| 22 | 22 | |
| 23 | - $this->object = new \Aimeos\Client\Html\Cms\Page\Standard( $this->context ); |
|
| 24 | - $this->object->setView( \TestHelperHtml::getView() ); |
|
| 23 | + $this->object = new \Aimeos\Client\Html\Cms\Page\Standard($this->context); |
|
| 24 | + $this->object->setView(\TestHelperHtml::getView()); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | protected function tearDown() : void |
| 29 | 29 | { |
| 30 | - unset( $this->object ); |
|
| 30 | + unset($this->object); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | public function testGetHeader() |
| 35 | 35 | { |
| 36 | 36 | $view = $this->object->getView(); |
| 37 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, array( 'path' => '/contact' ) ); |
|
| 38 | - $view->addHelper( 'param', $helper ); |
|
| 37 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, array('path' => '/contact')); |
|
| 38 | + $view->addHelper('param', $helper); |
|
| 39 | 39 | |
| 40 | 40 | $tags = []; |
| 41 | 41 | $expire = null; |
| 42 | 42 | |
| 43 | - $this->object->setView( $this->object->addData( $this->object->getView(), $tags, $expire ) ); |
|
| 43 | + $this->object->setView($this->object->addData($this->object->getView(), $tags, $expire)); |
|
| 44 | 44 | $output = $this->object->getHeader(); |
| 45 | 45 | |
| 46 | - $this->assertStringContainsString( '<title>Contact page</title>', $output ); |
|
| 47 | - $this->assertEquals( null, $expire ); |
|
| 48 | - $this->assertEquals( 2, count( $tags ) ); |
|
| 46 | + $this->assertStringContainsString('<title>Contact page</title>', $output); |
|
| 47 | + $this->assertEquals(null, $expire); |
|
| 48 | + $this->assertEquals(2, count($tags)); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | public function testGetHeaderException() |
| 53 | 53 | { |
| 54 | - $mock = $this->getMockBuilder( \Aimeos\Client\Html\Cms\Page\Standard::class ) |
|
| 55 | - ->setConstructorArgs( [$this->context] ) |
|
| 56 | - ->setMethods( array( 'addData' ) ) |
|
| 54 | + $mock = $this->getMockBuilder(\Aimeos\Client\Html\Cms\Page\Standard::class) |
|
| 55 | + ->setConstructorArgs([$this->context]) |
|
| 56 | + ->setMethods(array('addData')) |
|
| 57 | 57 | ->getMock(); |
| 58 | 58 | |
| 59 | 59 | $view = $this->object->getView(); |
| 60 | - $view->addHelper( 'param', new \Aimeos\MW\View\Helper\Param\Standard( $view, ['path' => 'invalid'] ) ); |
|
| 61 | - $mock->setView( $view ); |
|
| 60 | + $view->addHelper('param', new \Aimeos\MW\View\Helper\Param\Standard($view, ['path' => 'invalid'])); |
|
| 61 | + $mock->setView($view); |
|
| 62 | 62 | |
| 63 | - $mock->expects( $this->once() )->method( 'addData' ) |
|
| 64 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 63 | + $mock->expects($this->once())->method('addData') |
|
| 64 | + ->will($this->throwException(new \RuntimeException())); |
|
| 65 | 65 | |
| 66 | 66 | $mock->getHeader(); |
| 67 | 67 | } |
@@ -70,36 +70,36 @@ discard block |
||
| 70 | 70 | public function testGetBody() |
| 71 | 71 | { |
| 72 | 72 | $view = $this->object->getView(); |
| 73 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, array( 'path' => '/contact' ) ); |
|
| 74 | - $view->addHelper( 'param', $helper ); |
|
| 73 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, array('path' => '/contact')); |
|
| 74 | + $view->addHelper('param', $helper); |
|
| 75 | 75 | |
| 76 | 76 | $tags = []; |
| 77 | 77 | $expire = null; |
| 78 | 78 | |
| 79 | - $this->object->setView( $this->object->addData( $view, $tags, $expire ) ); |
|
| 79 | + $this->object->setView($this->object->addData($view, $tags, $expire)); |
|
| 80 | 80 | $output = $this->object->getBody(); |
| 81 | 81 | |
| 82 | - $this->assertStringStartsWith( '<section class="aimeos cms-page"', $output ); |
|
| 83 | - $this->assertStringContainsString( '<h1>Hello!</h1>', $output ); |
|
| 82 | + $this->assertStringStartsWith('<section class="aimeos cms-page"', $output); |
|
| 83 | + $this->assertStringContainsString('<h1>Hello!</h1>', $output); |
|
| 84 | 84 | |
| 85 | - $this->assertEquals( null, $expire ); |
|
| 86 | - $this->assertEquals( 2, count( $tags ) ); |
|
| 85 | + $this->assertEquals(null, $expire); |
|
| 86 | + $this->assertEquals(2, count($tags)); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | |
| 90 | 90 | public function testGetBodyClientHtmlException() |
| 91 | 91 | { |
| 92 | - $mock = $this->getMockBuilder( \Aimeos\Client\Html\Cms\Page\Standard::class ) |
|
| 93 | - ->setConstructorArgs( [$this->context] ) |
|
| 94 | - ->setMethods( array( 'addData' ) ) |
|
| 92 | + $mock = $this->getMockBuilder(\Aimeos\Client\Html\Cms\Page\Standard::class) |
|
| 93 | + ->setConstructorArgs([$this->context]) |
|
| 94 | + ->setMethods(array('addData')) |
|
| 95 | 95 | ->getMock(); |
| 96 | 96 | |
| 97 | 97 | $view = $this->object->getView(); |
| 98 | - $view->addHelper( 'param', new \Aimeos\MW\View\Helper\Param\Standard( $view, ['path' => 'invalid'] ) ); |
|
| 99 | - $mock->setView( $view ); |
|
| 98 | + $view->addHelper('param', new \Aimeos\MW\View\Helper\Param\Standard($view, ['path' => 'invalid'])); |
|
| 99 | + $mock->setView($view); |
|
| 100 | 100 | |
| 101 | - $mock->expects( $this->once() )->method( 'addData' ) |
|
| 102 | - ->will( $this->throwException( new \Aimeos\Client\Html\Exception() ) ); |
|
| 101 | + $mock->expects($this->once())->method('addData') |
|
| 102 | + ->will($this->throwException(new \Aimeos\Client\Html\Exception())); |
|
| 103 | 103 | |
| 104 | 104 | $mock->getBody(); |
| 105 | 105 | } |
@@ -107,17 +107,17 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | public function testGetBodyControllerFrontendException() |
| 109 | 109 | { |
| 110 | - $mock = $this->getMockBuilder( \Aimeos\Client\Html\Cms\Page\Standard::class ) |
|
| 111 | - ->setConstructorArgs( [$this->context] ) |
|
| 112 | - ->setMethods( array( 'addData' ) ) |
|
| 110 | + $mock = $this->getMockBuilder(\Aimeos\Client\Html\Cms\Page\Standard::class) |
|
| 111 | + ->setConstructorArgs([$this->context]) |
|
| 112 | + ->setMethods(array('addData')) |
|
| 113 | 113 | ->getMock(); |
| 114 | 114 | |
| 115 | 115 | $view = $this->object->getView(); |
| 116 | - $view->addHelper( 'param', new \Aimeos\MW\View\Helper\Param\Standard( $view, ['path' => 'invalid'] ) ); |
|
| 117 | - $mock->setView( $view ); |
|
| 116 | + $view->addHelper('param', new \Aimeos\MW\View\Helper\Param\Standard($view, ['path' => 'invalid'])); |
|
| 117 | + $mock->setView($view); |
|
| 118 | 118 | |
| 119 | - $mock->expects( $this->once() )->method( 'addData' ) |
|
| 120 | - ->will( $this->throwException( new \Aimeos\Controller\Frontend\Exception() ) ); |
|
| 119 | + $mock->expects($this->once())->method('addData') |
|
| 120 | + ->will($this->throwException(new \Aimeos\Controller\Frontend\Exception())); |
|
| 121 | 121 | |
| 122 | 122 | $mock->getBody(); |
| 123 | 123 | } |
@@ -125,17 +125,17 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | public function testGetBodyMShopException() |
| 127 | 127 | { |
| 128 | - $mock = $this->getMockBuilder( \Aimeos\Client\Html\Cms\Page\Standard::class ) |
|
| 129 | - ->setConstructorArgs( [$this->context] ) |
|
| 130 | - ->setMethods( array( 'addData' ) ) |
|
| 128 | + $mock = $this->getMockBuilder(\Aimeos\Client\Html\Cms\Page\Standard::class) |
|
| 129 | + ->setConstructorArgs([$this->context]) |
|
| 130 | + ->setMethods(array('addData')) |
|
| 131 | 131 | ->getMock(); |
| 132 | 132 | |
| 133 | 133 | $view = $this->object->getView(); |
| 134 | - $view->addHelper( 'param', new \Aimeos\MW\View\Helper\Param\Standard( $view, ['path' => 'invalid'] ) ); |
|
| 135 | - $mock->setView( $view ); |
|
| 134 | + $view->addHelper('param', new \Aimeos\MW\View\Helper\Param\Standard($view, ['path' => 'invalid'])); |
|
| 135 | + $mock->setView($view); |
|
| 136 | 136 | |
| 137 | - $mock->expects( $this->once() )->method( 'addData' ) |
|
| 138 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 137 | + $mock->expects($this->once())->method('addData') |
|
| 138 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
| 139 | 139 | |
| 140 | 140 | $mock->getBody(); |
| 141 | 141 | } |
@@ -143,17 +143,17 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | public function testGetBodyException() |
| 145 | 145 | { |
| 146 | - $mock = $this->getMockBuilder( \Aimeos\Client\Html\Cms\Page\Standard::class ) |
|
| 147 | - ->setConstructorArgs( [$this->context] ) |
|
| 148 | - ->setMethods( array( 'addData' ) ) |
|
| 146 | + $mock = $this->getMockBuilder(\Aimeos\Client\Html\Cms\Page\Standard::class) |
|
| 147 | + ->setConstructorArgs([$this->context]) |
|
| 148 | + ->setMethods(array('addData')) |
|
| 149 | 149 | ->getMock(); |
| 150 | 150 | |
| 151 | 151 | $view = $this->object->getView(); |
| 152 | - $view->addHelper( 'param', new \Aimeos\MW\View\Helper\Param\Standard( $view, ['path' => 'invalid'] ) ); |
|
| 153 | - $mock->setView( $view ); |
|
| 152 | + $view->addHelper('param', new \Aimeos\MW\View\Helper\Param\Standard($view, ['path' => 'invalid'])); |
|
| 153 | + $mock->setView($view); |
|
| 154 | 154 | |
| 155 | - $mock->expects( $this->once() )->method( 'addData' ) |
|
| 156 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
| 155 | + $mock->expects($this->once())->method('addData') |
|
| 156 | + ->will($this->throwException(new \RuntimeException())); |
|
| 157 | 157 | |
| 158 | 158 | $mock->getBody(); |
| 159 | 159 | } |
@@ -161,15 +161,15 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | public function testGetSubClientInvalid() |
| 163 | 163 | { |
| 164 | - $this->expectException( '\\Aimeos\\Client\\Html\\Exception' ); |
|
| 165 | - $this->object->getSubClient( 'invalid', 'invalid' ); |
|
| 164 | + $this->expectException('\\Aimeos\\Client\\Html\\Exception'); |
|
| 165 | + $this->object->getSubClient('invalid', 'invalid'); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
| 169 | 169 | public function testGetSubClientInvalidName() |
| 170 | 170 | { |
| 171 | - $this->expectException( '\\Aimeos\\Client\\Html\\Exception' ); |
|
| 172 | - $this->object->getSubClient( '$$$', '$$$' ); |
|
| 171 | + $this->expectException('\\Aimeos\\Client\\Html\\Exception'); |
|
| 172 | + $this->object->getSubClient('$$$', '$$$'); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | |
@@ -177,6 +177,6 @@ discard block |
||
| 177 | 177 | { |
| 178 | 178 | $this->object->process(); |
| 179 | 179 | |
| 180 | - $this->assertEmpty( $this->object->getView()->get( 'pageErrorList' ) ); |
|
| 180 | + $this->assertEmpty($this->object->getView()->get('pageErrorList')); |
|
| 181 | 181 | } |
| 182 | 182 | } |