diff --git a/lib/Controller/Base.php b/lib/Controller/Base.php index d6b3211f80..fc532b2bea 100644 --- a/lib/Controller/Base.php +++ b/lib/Controller/Base.php @@ -350,7 +350,7 @@ public function renderTwigAjaxReturn(Request $request, Response $response) // Render the view manually with Twig, parse it and pull out various bits try { - $view = $this->getView()->render($response,$state->template . '.twig', $data); + $view = $this->getView()->render($response, $state->template . '.twig', $data); } catch (LoaderError | RuntimeError | SyntaxError $e) { throw new GeneralException(__('Twig Error ') . $e->getMessage()); } diff --git a/lib/Controller/Library.php b/lib/Controller/Library.php index b6cf5d0262..98b762ead2 100644 --- a/lib/Controller/Library.php +++ b/lib/Controller/Library.php @@ -1453,7 +1453,7 @@ public function download(Request $request, Response $response) public function fontCss(Request $request, Response $response) { // Regenerate the CSS for fonts - $css = $this->getMediaService()->installFonts(RouteContext::fromRequest($request)->getRouteParser(),['invalidateCache' => false]); + $css = $this->getMediaService()->installFonts(RouteContext::fromRequest($request)->getRouteParser(), ['invalidateCache' => false]); // Work out the etag /** @var $httpCache HttpCacheProvider*/ diff --git a/lib/Controller/MenuBoardProduct.php b/lib/Controller/MenuBoardProduct.php index d567a92483..240faadbd8 100644 --- a/lib/Controller/MenuBoardProduct.php +++ b/lib/Controller/MenuBoardProduct.php @@ -193,7 +193,7 @@ public function grid(Request $request, Response $response, $id): Response 'text' => __('Delete'), 'multi-select' => true, 'dataAttributes' => [ - ['name' => 'commit-url', 'value' => $this->urlFor($request,'menuBoard.product.delete', ['id' => $menuBoardProduct->menuProductId])], + ['name' => 'commit-url', 'value' => $this->urlFor($request, 'menuBoard.product.delete', ['id' => $menuBoardProduct->menuProductId])], ['name' => 'commit-method', 'value' => 'delete'], ['name' => 'id', 'value' => 'menuBoardProduct_delete_button'], ['name' => 'text', 'value' => __('Delete')], diff --git a/lib/Controller/Report.php b/lib/Controller/Report.php index 05d33320e7..da697c9d0c 100644 --- a/lib/Controller/Report.php +++ b/lib/Controller/Report.php @@ -1056,11 +1056,11 @@ public function savedReportExport(Request $request, Response $response, $id, $na $emailTemplate = $this->reportService->getReportEmailTemplate($name); if (!empty($emailTemplate)) { - // Save PDF attachment ob_start(); // Render the template - echo $this->getView()->fetch($emailTemplate, + echo $this->getView()->fetch( + $emailTemplate, [ 'header' => $report->description, 'logo' => $this->getConfig()->uri('img/xibologo.png', true), @@ -1072,7 +1072,8 @@ public function savedReportExport(Request $request, Response $response, $id, $na 'src' => isset($src) ? $src : null, 'multipleCharts' => isset($multipleCharts) ? $multipleCharts : null, 'placeholder' => isset($placeholder) ? $placeholder : null - ]); + ] + ); $body = ob_get_contents(); ob_end_clean(); diff --git a/lib/Controller/User.php b/lib/Controller/User.php index eb464f588c..7fcf50f348 100644 --- a/lib/Controller/User.php +++ b/lib/Controller/User.php @@ -1620,7 +1620,7 @@ public function permissionsMultiGrid(Request $request, Response $response, $enti for ($i=0; $i < count($ids); $i++) { $objectId = $ids[$i]; - $objects[$i] = $this->parsePermissionsEntity($entity, $objectId);; + $objects[$i] = $this->parsePermissionsEntity($entity, $objectId); // Does this user have permission to edit the permissions?! if (!$this->getUser()->checkPermissionsModifyable($objects[$i])) { @@ -1864,7 +1864,7 @@ public function permissions(Request $request, Response $response, $entity, $id) /** @var $object Media */ if ($object->mediaType === 'font') { // Drop permissions (we need to reassess). - $this->getMediaService($this->getUser())->installFonts(RouteContext::fromRequest($request)->getRouteParser(),['invalidateCache' => true]); + $this->getMediaService($this->getUser())->installFonts(RouteContext::fromRequest($request)->getRouteParser(), ['invalidateCache' => true]); } } diff --git a/lib/Entity/Folder.php b/lib/Entity/Folder.php index 92345df9b0..b24e5aa7ba 100644 --- a/lib/Entity/Folder.php +++ b/lib/Entity/Folder.php @@ -165,8 +165,6 @@ public function save($validate = true) } else { $this->edit(); } - - } public function delete() @@ -226,7 +224,6 @@ private function manageChildren($mode) $children = array_filter(explode(',', $this->children)); if ($mode === 'delete') { - // remove this folder from children of the parent foreach ($parentChildren as $index => $child) { if ((int)$child === (int)$this->id) { @@ -324,39 +321,39 @@ private function manageChildPermissions($permissionFolderId) private function updateChildObjects($permissionFolderId, $folderId) { - $this->getStore()->update('UPDATE `folder` SET permissionsFolderId = :permissionsFolderId WHERE parentId = :folderId',[ + $this->getStore()->update('UPDATE `folder` SET permissionsFolderId = :permissionsFolderId WHERE parentId = :folderId', [ 'permissionsFolderId' => $permissionFolderId, 'folderId' => $folderId ]); - $this->getStore()->update('UPDATE `media` SET permissionsFolderId = :permissionsFolderId WHERE folderId = :folderId',[ + $this->getStore()->update('UPDATE `media` SET permissionsFolderId = :permissionsFolderId WHERE folderId = :folderId', [ 'permissionsFolderId' => $permissionFolderId, 'folderId' => $folderId ]); - $this->getStore()->update('UPDATE `campaign` SET permissionsFolderId = :permissionsFolderId WHERE folderId = :folderId',[ + $this->getStore()->update('UPDATE `campaign` SET permissionsFolderId = :permissionsFolderId WHERE folderId = :folderId', [ 'permissionsFolderId' => $permissionFolderId, 'folderId' => $folderId ]); - $this->getStore()->update('UPDATE `displaygroup` SET permissionsFolderId = :permissionsFolderId WHERE folderId = :folderId',[ + $this->getStore()->update('UPDATE `displaygroup` SET permissionsFolderId = :permissionsFolderId WHERE folderId = :folderId', [ 'permissionsFolderId' => $permissionFolderId, 'folderId' => $folderId ]); - $this->getStore()->update('UPDATE `dataset` SET permissionsFolderId = :permissionsFolderId WHERE folderId = :folderId',[ + $this->getStore()->update('UPDATE `dataset` SET permissionsFolderId = :permissionsFolderId WHERE folderId = :folderId', [ 'permissionsFolderId' => $permissionFolderId, 'folderId' => $folderId ]); - $this->getStore()->update('UPDATE `playlist` SET permissionsFolderId = :permissionsFolderId WHERE folderId = :folderId',[ + $this->getStore()->update('UPDATE `playlist` SET permissionsFolderId = :permissionsFolderId WHERE folderId = :folderId', [ 'permissionsFolderId' => $permissionFolderId, 'folderId' => $folderId ]); - $this->getStore()->update('UPDATE `menu_board` SET permissionsFolderId = :permissionsFolderId WHERE folderId = :folderId',[ + $this->getStore()->update('UPDATE `menu_board` SET permissionsFolderId = :permissionsFolderId WHERE folderId = :folderId', [ 'permissionsFolderId' => $permissionFolderId, 'folderId' => $folderId ]); } -} \ No newline at end of file +} diff --git a/lib/Factory/ModuleFactory.php b/lib/Factory/ModuleFactory.php index 5d6590da98..62bc3a2ea3 100644 --- a/lib/Factory/ModuleFactory.php +++ b/lib/Factory/ModuleFactory.php @@ -196,10 +196,22 @@ public function create($type) { $modules = $this->query(['enabled DESC'], array('type' => $type)); - $this->getLog()->debug(sprintf('Creating %s out of possible %s', $type, json_encode(array_map(function($element) { return $element->class; }, $modules)))); - - if (count($modules) <= 0) + $this->getLog()->debug(sprintf( + 'Creating %s out of possible %s', + $type, + json_encode( + array_map( + function ($element) { + return $element->class; + }, + $modules + ) + ) + )); + + if (count($modules) <= 0) { throw new NotFoundException(sprintf(__('Unknown type %s'), $type)); + } // Create a module return $this->moduleService->get( @@ -232,10 +244,22 @@ public function createByClass($class) { $modules = $this->query(['enabled DESC'], array('class' => $class)); - $this->getLog()->debug(sprintf('Creating %s out of possible %s', $class, json_encode(array_map(function($element) { return $element->class; }, $modules)))); - - if (count($modules) <= 0) + $this->getLog()->debug(sprintf( + 'Creating %s out of possible %s', + $class, + json_encode( + array_map( + function ($element) { + return $element->class; + }, + $modules + ) + ) + )); + + if (count($modules) <= 0) { throw new NotFoundException(sprintf(__('Unknown class %s'), $class)); + } // Create a module return $this->moduleService->get( @@ -324,8 +348,9 @@ public function createWithMedia($media) { $modules = $this->query(null, array('type' => $media->mediaType)); - if (count($modules) <= 0) + if (count($modules) <= 0) { throw new NotFoundException(sprintf(__('Unknown type %s'), $media->mediaType)); + } // Create a widget $widget = $this->widgetFactory->createEmpty(); @@ -389,8 +414,7 @@ public function createForWidget($type, $widgetId = 0, $ownerId = 0, $playlistId // Create a new widget to use $widget = $this->widgetFactory->create($ownerId, $playlistId, $module->getModuleType(), null); $module->setWidget($widget); - } - else { + } else { // Load the widget $module->setWidget($this->widgetFactory->loadByWidgetId($widgetId)); } @@ -434,8 +458,7 @@ public function get($key = 'type') $modules = $this->query(); if ($key != null && $key != '') { - - $keyed = array(); + $keyed = []; foreach ($modules as $module) { /* @var Module $module */ $keyed[$module->type] = $module; @@ -465,8 +488,9 @@ public function getById($moduleId) { $modules = $this->query(null, array('moduleId' => $moduleId)); - if (count($modules) <= 0) + if (count($modules) <= 0) { throw new NotFoundException(); + } return $modules[0]; } @@ -481,8 +505,9 @@ public function getByInstallName($installName) { $modules = $this->query(null, ['installName' => $installName]); - if (count($modules) <= 0) + if (count($modules) <= 0) { throw new NotFoundException(); + } return $modules[0]; } @@ -498,8 +523,9 @@ public function getByType($name) { $modules = $this->query(['enabled DESC'], ['name' => $name]); - if (count($modules) <= 0) + if (count($modules) <= 0) { throw new NotFoundException(sprintf(__('Module type %s does not match any enabled Module'), $name)); + } return $modules[0]; } @@ -523,8 +549,9 @@ public function getByExtension($extension) { $modules = $this->query(['enabled DESC'], array('extension' => $extension)); - if (count($modules) <= 0) + if (count($modules) <= 0) { throw new NotFoundException(sprintf(__('Extension %s does not match any enabled Module'), $extension)); + } return $modules[0]; } @@ -539,7 +566,7 @@ public function getValidExtensions($filterBy = []) $modules = $this->query(null, $filterBy); $extensions = array(); - foreach($modules as $module) { + foreach ($modules as $module) { /* @var Module $module */ if ($module->validExtensions != '') { foreach (explode(',', $module->validExtensions) as $extension) { @@ -577,8 +604,9 @@ public function query($sortOrder = null, $filterBy = []) { $parsedBody = $this->getSanitizer($filterBy); - if ($sortOrder == null) + if ($sortOrder == null) { $sortOrder = array('Module'); + } $entries = array(); @@ -665,8 +693,9 @@ public function query($sortOrder = null, $filterBy = []) // Sorting? $order = ''; - if (is_array($sortOrder)) + if (is_array($sortOrder)) { $order .= 'ORDER BY ' . implode(',', $sortOrder); + } $limit = ''; // Paging @@ -718,4 +747,4 @@ public function query($sortOrder = null, $filterBy = []) return $entries; } -} \ No newline at end of file +} diff --git a/lib/Middleware/Actions.php b/lib/Middleware/Actions.php index 02a2d19114..fb06e40390 100644 --- a/lib/Middleware/Actions.php +++ b/lib/Middleware/Actions.php @@ -64,16 +64,26 @@ public function process(Request $request, RequestHandler $handler): Response // Process Actions if (!Environment::migrationPending() && $container->get('configService')->getSetting('DEFAULTS_IMPORTED') == 0) { - $folder = $container->get('configService')->uri('layouts', true); foreach (array_diff(scandir($folder), array('..', '.')) as $file) { if (stripos($file, '.zip')) { try { /** @var \Xibo\Entity\Layout $layout */ - $layout = $container->get('layoutFactory')->createFromZip($folder . '/' . $file, null, - $container->get('userFactory')->getSystemUser()->getId(), false, false, true, false, - true, $container->get('dataSetFactory'), null, $routeContext->getRouteParser(), $container->get('mediaService')); + $layout = $container->get('layoutFactory')->createFromZip( + $folder . '/' . $file, + null, + $container->get('userFactory')->getSystemUser()->getId(), + false, + false, + true, + false, + true, + $container->get('dataSetFactory'), + null, + $routeContext->getRouteParser(), + $container->get('mediaService') + ); $layout->save([ 'audit' => false, 'import' => true @@ -179,4 +189,4 @@ private function isAjax(Request $request) { return strtolower($request->getHeaderLine('X-Requested-With')) === 'xmlhttprequest'; } -} \ No newline at end of file +} diff --git a/lib/Middleware/State.php b/lib/Middleware/State.php index cc298e2d3a..c9a8c269f9 100644 --- a/lib/Middleware/State.php +++ b/lib/Middleware/State.php @@ -1325,7 +1325,7 @@ public static function registerFactoriesWithDi() public static function registerDispatcherWithDi() { return [ - 'dispatcher' => function(ContainerInterface $c) { + 'dispatcher' => function (ContainerInterface $c) { $dispatcher = new EventDispatcher(); // Media Delete Events diff --git a/tests/integration/MenuBoardCategoryTest.php b/tests/integration/MenuBoardCategoryTest.php index 111689eb36..dd819c3a20 100644 --- a/tests/integration/MenuBoardCategoryTest.php +++ b/tests/integration/MenuBoardCategoryTest.php @@ -54,7 +54,7 @@ public function tearDown() public function testListEmpty() { - $response = $this->sendRequest('GET','/menuboard/' . $this->menuBoard['menuId'] . '/categories'); + $response = $this->sendRequest('GET', '/menuboard/' . $this->menuBoard['menuId'] . '/categories'); $this->assertSame(200, $response->getStatusCode()); $this->assertNotEmpty($response->getBody()); @@ -68,7 +68,7 @@ public function testAdd() $media = (new XiboLibrary($this->getEntityProvider()))->create(Random::generateString(10, 'API Image'), PROJECT_ROOT . '/tests/resources/xts-night-001.jpg'); $name = Random::generateString(10, 'Category Add'); - $response = $this->sendRequest('POST','/menuboard/' . $this->menuBoard['menuId'] . '/category', [ + $response = $this->sendRequest('POST', '/menuboard/' . $this->menuBoard['menuId'] . '/category', [ 'name' => $name, 'mediaId' => $media->mediaId ]); @@ -86,16 +86,16 @@ public function testAdd() public function testEdit() { - $menuBoardCategory = $this->getEntityProvider()->post( '/menuboard/' . $this->menuBoard['menuId'] . '/category', [ + $menuBoardCategory = $this->getEntityProvider()->post('/menuboard/' . $this->menuBoard['menuId'] . '/category', [ 'name' => 'Test Menu Board Category Edit' ]); $name = Random::generateString(10, 'Category Edit'); - $response = $this->sendRequest('PUT','/menuboard/' . $menuBoardCategory['menuCategoryId'] . '/category', [ + $response = $this->sendRequest('PUT', '/menuboard/' . $menuBoardCategory['menuCategoryId'] . '/category', [ 'name' => $name, ]); - $this->assertSame(200, $response->getStatusCode(), "Not successful: " . $response->getBody()); + $this->assertSame(200, $response->getStatusCode(), 'Not successful: ' . $response->getBody()); $object = json_decode($response->getBody()); $this->assertObjectHasAttribute('data', $object); @@ -113,6 +113,6 @@ public function testDelete() $object = json_decode($response->getBody()); $this->assertSame(204, $object->status); - $this->assertSame(200, $response->getStatusCode(), "Not successful: " . $response->getBody()); + $this->assertSame(200, $response->getStatusCode(), 'Not successful: ' . $response->getBody()); } } diff --git a/tests/integration/MenuBoardProductTest.php b/tests/integration/MenuBoardProductTest.php index 520dcb273e..350bc6cd9b 100644 --- a/tests/integration/MenuBoardProductTest.php +++ b/tests/integration/MenuBoardProductTest.php @@ -43,7 +43,7 @@ public function setup() 'description' => 'Description for test Menu Board' ]); - $this->menuBoardCategory = $this->getEntityProvider()->post( '/menuboard/' . $this->menuBoard['menuId'] . '/category', [ + $this->menuBoardCategory = $this->getEntityProvider()->post('/menuboard/' . $this->menuBoard['menuId'] . '/category', [ 'name' => 'Test Menu Board Category Edit' ]); } @@ -59,7 +59,7 @@ public function tearDown() public function testListEmpty() { - $response = $this->sendRequest('GET','/menuboard/' . $this->menuBoardCategory['menuCategoryId'] . '/products'); + $response = $this->sendRequest('GET', '/menuboard/' . $this->menuBoardCategory['menuCategoryId'] . '/products'); $this->assertSame(200, $response->getStatusCode()); $this->assertNotEmpty($response->getBody()); @@ -73,7 +73,7 @@ public function testAdd() $media = (new XiboLibrary($this->getEntityProvider()))->create(Random::generateString(10, 'API Image'), PROJECT_ROOT . '/tests/resources/xts-night-001.jpg'); $name = Random::generateString(10, 'Product Add'); - $response = $this->sendRequest('POST','/menuboard/' . $this->menuBoardCategory['menuCategoryId'] . '/product', [ + $response = $this->sendRequest('POST', '/menuboard/' . $this->menuBoardCategory['menuCategoryId'] . '/product', [ 'name' => $name, 'mediaId' => $media->mediaId, 'price' => '$12.40', @@ -85,7 +85,7 @@ public function testAdd() ]); - $this->assertSame(200, $response->getStatusCode(), "Not successful: " . $response->getBody()); + $this->assertSame(200, $response->getStatusCode(), 'Not successful: ' . $response->getBody()); $object = json_decode($response->getBody()); @@ -103,9 +103,9 @@ public function testAdd() $this->assertSame('small', $object->data->productOptions[2]->option); $this->assertSame('$10.40', $object->data->productOptions[2]->value); $this->assertSame($object->id, $object->data->productOptions[1]->menuProductId); - $this->assertSame('medium', $object->data->productOptions[1]->option); - $this->assertSame('$15.40', $object->data->productOptions[1]->value); - $this->assertSame($object->id, $object->data->productOptions[0]->menuProductId); + $this->assertSame('medium', $object->data->productOptions[1]->option); + $this->assertSame('$15.40', $object->data->productOptions[1]->value); + $this->assertSame($object->id, $object->data->productOptions[0]->menuProductId); $this->assertSame('large', $object->data->productOptions[0]->option); $this->assertSame('$20.20', $object->data->productOptions[0]->value); @@ -117,7 +117,7 @@ public function testAdd() */ public function testAddFailure($name, $price) { - $response = $this->sendRequest('POST','/menuboard/' . $this->menuBoardCategory['menuCategoryId'] . '/product', [ + $response = $this->sendRequest('POST', '/menuboard/' . $this->menuBoardCategory['menuCategoryId'] . '/product', [ 'name' => $name, 'price' => $price ]); @@ -141,7 +141,7 @@ public function provideFailureCases() public function testEdit() { - $menuBoardProduct = $this->getEntityProvider()->post( '/menuboard/' . $this->menuBoardCategory['menuCategoryId'] . '/product', [ + $menuBoardProduct = $this->getEntityProvider()->post('/menuboard/' . $this->menuBoardCategory['menuCategoryId'] . '/product', [ 'name' => 'Test Menu Board Product Edit', 'price' => '$11.11', 'productOptions' => ['small', 'medium', 'large'], @@ -149,7 +149,7 @@ public function testEdit() ]); $name = Random::generateString(10, 'Product Edit'); - $response = $this->sendRequest('PUT','/menuboard/' . $menuBoardProduct['menuProductId'] . '/product', [ + $response = $this->sendRequest('PUT', '/menuboard/' . $menuBoardProduct['menuProductId'] . '/product', [ 'name' => $name, 'price' => '$9.99', 'description' => 'Product Description Edited', @@ -159,7 +159,7 @@ public function testEdit() 'productValues' => ['$8.40', '$12.40', '$15.20'] ]); - $this->assertSame(200, $response->getStatusCode(), "Not successful: " . $response->getBody()); + $this->assertSame(200, $response->getStatusCode(), 'Not successful: ' . $response->getBody()); $object = json_decode($response->getBody()); $this->assertObjectHasAttribute('data', $object); @@ -175,9 +175,9 @@ public function testEdit() $this->assertSame('small', $object->data->productOptions[2]->option); $this->assertSame('$8.40', $object->data->productOptions[2]->value); $this->assertSame($object->id, $object->data->productOptions[1]->menuProductId); - $this->assertSame('medium', $object->data->productOptions[1]->option); - $this->assertSame('$12.40', $object->data->productOptions[1]->value); - $this->assertSame($object->id, $object->data->productOptions[0]->menuProductId); + $this->assertSame('medium', $object->data->productOptions[1]->option); + $this->assertSame('$12.40', $object->data->productOptions[1]->value); + $this->assertSame($object->id, $object->data->productOptions[0]->menuProductId); $this->assertSame('large', $object->data->productOptions[0]->option); $this->assertSame('$15.20', $object->data->productOptions[0]->value); } @@ -193,6 +193,6 @@ public function testDelete() $object = json_decode($response->getBody()); $this->assertSame(204, $object->status); - $this->assertSame(200, $response->getStatusCode(), "Not successful: " . $response->getBody()); + $this->assertSame(200, $response->getStatusCode(), 'Not successful: ' . $response->getBody()); } } diff --git a/tests/integration/MenuBoardTest.php b/tests/integration/MenuBoardTest.php index 1a06272ae9..2c0c8bab0d 100644 --- a/tests/integration/MenuBoardTest.php +++ b/tests/integration/MenuBoardTest.php @@ -48,7 +48,7 @@ public function tearDown() public function testListAll() { - $response = $this->sendRequest('GET','/menuboards'); + $response = $this->sendRequest('GET', '/menuboards'); $this->assertSame(200, $response->getStatusCode()); $this->assertNotEmpty($response->getBody()); @@ -59,12 +59,12 @@ public function testListAll() public function testAdd() { $name = Random::generateString(10, 'MenuBoard Add'); - $response = $this->sendRequest('POST','/menuboard', [ + $response = $this->sendRequest('POST', '/menuboard', [ 'name' => $name, 'description' => 'Description for test Menu Board Add' ]); - $this->assertSame(200, $response->getStatusCode(), "Not successful: " . $response->getBody()); + $this->assertSame(200, $response->getStatusCode(), 'Not successful: ' . $response->getBody()); $object = json_decode($response->getBody()); $this->assertObjectHasAttribute('data', $object); @@ -82,12 +82,12 @@ public function testEdit() 'description' => 'Description for test Menu Board Edit' ]); $name = Random::generateString(10, 'MenuBoard Edit'); - $response = $this->sendRequest('PUT','/menuboard/' . $menuBoard['menuId'], [ + $response = $this->sendRequest('PUT', '/menuboard/' . $menuBoard['menuId'], [ 'name' => $name, 'description' => 'Test Menu Board Edited description' ]); - $this->assertSame(200, $response->getStatusCode(), "Not successful: " . $response->getBody()); + $this->assertSame(200, $response->getStatusCode(), 'Not successful: ' . $response->getBody()); $object = json_decode($response->getBody()); $this->assertObjectHasAttribute('data', $object); @@ -109,6 +109,6 @@ public function testDelete() $object = json_decode($response->getBody()); $this->assertSame(204, $object->status); - $this->assertSame(200, $response->getStatusCode(), "Not successful: " . $response->getBody()); + $this->assertSame(200, $response->getStatusCode(), 'Not successful: ' . $response->getBody()); } } diff --git a/tests/integration/Widget/MenuBoardWidgetTest.php b/tests/integration/Widget/MenuBoardWidgetTest.php index 2c2a8e1a66..5ce47a81f8 100644 --- a/tests/integration/Widget/MenuBoardWidgetTest.php +++ b/tests/integration/Widget/MenuBoardWidgetTest.php @@ -67,7 +67,7 @@ public function setup() 'description' => 'Description for test Menu Board' ]); - $this->menuBoardCategory = $this->getEntityProvider()->post( '/menuboard/' . $this->menuBoard['menuId'] . '/category', [ + $this->menuBoardCategory = $this->getEntityProvider()->post('/menuboard/' . $this->menuBoard['menuId'] . '/category', [ 'name' => 'phpunit Menu Board Category' ]); @@ -109,7 +109,7 @@ public function tearDown() public function testEdit() { - $response = $this->sendRequest('PUT','/playlist/widget/' . $this->widgetId, [ + $response = $this->sendRequest('PUT', '/playlist/widget/' . $this->widgetId, [ 'name' => 'Test Menu Board Widget', 'duration' => 60, 'useDuration' => 1, @@ -130,16 +130,15 @@ public function testEdit() foreach ($widget['widgetOptions'] as $option) { if ($option['option'] == 'showUnavailable') { $this->assertSame(0, intval($option['value'])); - } else if ($option['option'] == 'showImagesFor') { + } elseif ($option['option'] == 'showImagesFor') { $this->assertSame('product', $option['value']); - } else if ($option['option'] == 'templateId') { + } elseif ($option['option'] == 'templateId') { $this->assertSame('menuboard', $option['value']); - } else if ($option['option'] == 'name') { + } elseif ($option['option'] == 'name') { $this->assertSame('Test Menu Board Widget', $option['value']); - } else if ($option['option'] == 'productsHighlight') { + } elseif ($option['option'] == 'productsHighlight') { $this->assertSame([$this->menuBoardProduct['menuBoardProductId']], $option['value']); } } } } -