コード例 #1
0
 /**
  * Delete CMS Block.
  *
  * @param CmsBlock $cmsBlock
  * @return void
  */
 public function test(CmsBlock $cmsBlock)
 {
     // Precondition
     $cmsBlock->persist();
     $filter = ['identifier' => $cmsBlock->getIdentifier()];
     // Steps
     $this->cmsBlockIndex->open();
     $this->cmsBlockIndex->getCmsBlockGrid()->searchAndOpen($filter, true, false);
     $this->cmsBlockNew->getFormPageActions()->delete();
 }
コード例 #2
0
 /**
  * Assert that created CMS block can't be found in grid via:
  * title, identifier, store view, status, created and modified date
  *
  * @param CmsBlock $cmsBlock
  * @param CmsBlockIndex $cmsBlockIndex
  * @return void
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function processAssert(CmsBlock $cmsBlock, CmsBlockIndex $cmsBlockIndex)
 {
     $cmsBlockIndex->open();
     $data = $cmsBlock->getData();
     if (isset($data['stores'])) {
         $storeId = is_array($data['stores']) ? reset($data['stores']) : $data['stores'];
         $parts = explode("/", $storeId);
     }
     $filter = ['title' => $data['title'], 'identifier' => $data['identifier'], 'is_active' => $data['is_active'], 'store_id' => end($parts)];
     // add creation_time & update_time to filter if there are ones
     if (isset($data['creation_time'])) {
         $filter['creation_time_from'] = date("M j, Y", strtotime($cmsBlock->getCreationTime()));
     }
     if (isset($data['update_time'])) {
         $filter['update_time_from'] = date("M j, Y", strtotime($cmsBlock->getUpdateTime()));
     }
     \PHPUnit_Framework_Assert::assertFalse($cmsBlockIndex->getCmsBlockGrid()->isRowVisible($filter, true, false), 'CMS Block with ' . 'title \'' . $filter['title'] . '\', ' . 'identifier \'' . $filter['identifier'] . '\', ' . 'store view \'' . $filter['store_id'] . '\', ' . 'status \'' . $filter['is_active'] . '\', ' . (isset($filter['creation_time_from']) ? 'creation_time \'' . $filter['creation_time_from'] . '\', ' : '') . (isset($filter['update_time_from']) ? 'update_time \'' . $filter['update_time_from'] . '\'' : '') . 'exists in CMS Block grid.');
 }
コード例 #3
0
 /**
  * Assert that created CMS block can be found in grid via:
  * title, identifier, store view, status, created and modified date.
  *
  * @param CmsBlock $cmsBlock
  * @param CmsBlockIndex $cmsBlockIndex
  * @return void
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function processAssert(CmsBlock $cmsBlock, CmsBlockIndex $cmsBlockIndex)
 {
     $cmsBlockIndex->open();
     $data = $cmsBlock->getData();
     $data['is_active'] = $data['is_active'] == 'Yes' ? 'Enabled' : 'Disabled';
     $filter = ['title' => $data['title'], 'identifier' => $data['identifier'], 'is_active' => $data['is_active']];
     if (isset($data['stores'])) {
         $filter['store_id'] = is_array($data['stores']) ? reset($data['stores']) : $data['stores'];
     }
     // add creation_time & update_time to filter if there are ones
     if (isset($data['creation_time'])) {
         $filter['creation_time_from'] = date("M j, Y", strtotime($cmsBlock->getCreationTime()));
     }
     if (isset($data['update_time'])) {
         $filter['update_time_from'] = date("M j, Y", strtotime($cmsBlock->getUpdateTime()));
     }
     $cmsBlockIndex->getCmsBlockGrid()->search($filter);
     if (isset($filter['store_id'])) {
         $pieces = explode('/', $filter['store_id']);
         $filter['store_id'] = end($pieces);
     }
     \PHPUnit_Framework_Assert::assertTrue($cmsBlockIndex->getCmsBlockGrid()->isRowVisible($filter, false, false), 'CMS Block with ' . 'title \'' . $filter['title'] . '\', ' . 'identifier \'' . $filter['identifier'] . '\', ' . 'store view \'' . $filter['store_id'] . '\', ' . 'status \'' . $filter['is_active'] . '\', ' . (isset($filter['creation_time_from']) ? 'creation_time \'' . $filter['creation_time_from'] . '\', ' : '') . (isset($filter['update_time_from']) ? 'update_time \'' . $filter['update_time_from'] . '\'' : '') . 'is absent in CMS Block grid.');
 }
コード例 #4
0
 /**
  * Assert that after save block successful message appears.
  *
  * @param CmsBlockIndex $cmsBlockIndex
  * @return void
  */
 public function processAssert(CmsBlockIndex $cmsBlockIndex)
 {
     $actualMessage = $cmsBlockIndex->getMessagesBlock()->getSuccessMessage();
     \PHPUnit_Framework_Assert::assertEquals(self::SUCCESS_SAVE_MESSAGE, $actualMessage, 'Wrong success message is displayed.' . "\nExpected: " . self::SUCCESS_SAVE_MESSAGE . "\nActual: " . $actualMessage);
 }