Пример #1
0
 public function testSaveAction()
 {
     $helper = new AW_Autorelated_Test_Helper();
     if ($helper->prepareAdminUser()) {
         $this->getRequest()->setMethod('GET');
         $this->dispatch('awautorelated_admin/adminhtml_categoryblock/save');
         $this->assertRedirectTo('awautorelated_admin/adminhtml_blocksgrid/list');
         $helper->preparePost($this->getRequest());
         $this->dispatch('awautorelated_admin/adminhtml_categoryblock/save');
         $this->assertRedirectTo('awautorelated_admin/adminhtml_categoryblock/edit', array('fswe' => 1));
     }
 }
Пример #2
0
 public function testSelecttypePostAction()
 {
     $helper = new AW_Autorelated_Test_Helper();
     if ($helper->prepareAdminUser()) {
         $helper->preparePost($this->getRequest());
         $this->dispatch('awautorelated_admin/adminhtml_blocksgrid/selecttype');
         $this->assertRedirectTo('awautorelated_admin/adminhtml_blocksgrid/selecttype');
         $helper->preparePost($this->getRequest());
         $this->getRequest()->setParam('block_type', AW_Autorelated_Model_Source_Type::PRODUCT_PAGE_BLOCK);
         $this->dispatch('awautorelated_admin/adminhtml_blocksgrid/selecttype');
         $this->assertRedirectTo('awautorelated_admin/adminhtml_productblock/new');
         $helper->preparePost($this->getRequest());
         $this->getRequest()->setParam('block_type', AW_Autorelated_Model_Source_Type::CATEGORY_PAGE_BLOCK);
         $this->dispatch('awautorelated_admin/adminhtml_blocksgrid/selecttype');
         $this->assertRedirectTo('awautorelated_admin/adminhtml_categoryblock/new');
     }
 }
Пример #3
0
 public static function prepareAdminUser($renew = false)
 {
     if (self::$_isAdminPrepared === null || $renew) {
         Mage::getSingleton('core/session', array('name' => 'adminhtml'));
         $user = Mage::getModel('admin/user')->loadByUsername('master');
         if (Mage::getSingleton('adminhtml/url')->useSecretKey()) {
             Mage::getSingleton('adminhtml/url')->renewSecretUrls();
         }
         $session = Mage::getSingleton('admin/session');
         $session->setIsFirstVisit(true);
         $session->setUser($user);
         $session->setAcl(Mage::getResourceModel('admin/acl')->loadAcl());
         self::$_isAdminPrepared = $session->isLoggedIn();
     }
     return self::$_isAdminPrepared;
 }