/** * Assert that displayed banner data on edit page equals passed from fixture. * * @param Banner $banner * @param BannerIndex $bannerIndex * @param BannerEdit $bannerEdit * @return void */ public function processAssert(Banner $banner, BannerIndex $bannerIndex, BannerEdit $bannerEdit) { $bannerIndex->open(); $bannerIndex->getGrid()->searchAndOpen(['name' => $banner->getName()]); $fixtureData = $banner->getData(); $formData = $bannerEdit->getBannerForm()->getData($banner); $errors = $this->verifyData($fixtureData, $formData); \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); }
/** * Assert that created banner is found by name and has correct banner types, visibility, status. * * @param Banner $banner * @param BannerIndex $bannerIndex * @return void */ public function processAssert(Banner $banner, BannerIndex $bannerIndex) { $bannerIndex->open(); $filter = ['name' => $banner->getName(), 'active' => $banner->getIsEnabled()]; $isStoreContents = $banner->getStoreContents(); if (isset($isStoreContents['store_views'])) { $filter['visibility'] = $banner->getDataFieldConfig('store_contents')['source']->getStore(); } $bannerIndex->getGrid()->search($filter); if ($banner->hasData('types')) { $filter['types'] = implode(', ', $banner->getTypes()); } unset($filter['visibility']); \PHPUnit_Framework_Assert::assertTrue($bannerIndex->getGrid()->isRowVisible($filter, false), 'Banner is absent in grid.'); }