/** * replaces a model resource collection * @param $classAlias * @param $dataValues * @return PHPUnit_Framework_MockObject_MockObject */ public function getResourceCollectionModelMock($classAlias, $dataValues) { $mockPage1 = $this->getObjectMockGetData($dataValues[0]); $mockPage2 = $this->getObjectMockGetData($dataValues[1]); $iteratorValues = array($mockPage1, $mockPage2); $resourceCmsPageCollection = $this->testCase->getResourceModelMock($classAlias, array(), FALSE, array(), '', FALSE); $resourceCmsPageCollection->expects($this->testCase->any())->method('getIterator')->will($this->testCase->returnValue(new ArrayIterator($iteratorValues))); return $resourceCmsPageCollection; }
protected function setUp() { parent::setUp(); $this->helper = Mage::helper('helpdesk/notification'); $this->helper->emails = array(); Mage::helper('msttest/mock')->mockSingletonMethod('helpdesk/config', array('getNotificationHistoryRecordsNumber' => 3)); }
/** * Set up test class */ protected function setUp() { parent::setUp(); $this->_model = Mage::getModel('debit/entity_customer_attribute_backend_encrypted'); $attribute = Mage::getModel('eav/entity_attribute')->loadByCode('customer', 'debit_payment_account_swift'); $this->_model->setAttribute($attribute); }
public function setUp() { parent::setup(); $this->_helper = Mage::helper('ops/payment'); $this->store = Mage::app()->getStore(0)->load(0); $this->store->resetConfig(); }
protected function tearDown() { parent::tearDown(); $couponTable = Mage::getSingleton('core/resource')->getTableName('collpur/coupon'); $write = Mage::getSingleton('core/resource')->getConnection('core_write'); $write->truncate($couponTable); }
/** * setUp method */ public function setUp() { parent::setUp(); // checking if var directory exists, if not, then create it if (!is_dir(Mage::getBaseDir('var'))) { umask(0); mkdir(Mage::getBaseDir('var'), 0777, true); } // checking if log directory exists, if not, then create it if (!is_dir(Mage::getBaseDir('log'))) { umask(0); mkdir(Mage::getBaseDir('log'), 0777, true); } // checking if var/log/system.log file exist, if not create it if (!file_exists(Mage::getBaseDir('log') . DS . 'system.log')) { file_put_contents(Mage::getBaseDir('log') . DS . 'system.log', ''); } // checking if var/log/exception.log file exist, if not create it if (!file_exists(Mage::getBaseDir('log') . DS . 'exception.log')) { file_put_contents(Mage::getBaseDir('log') . DS . 'exception.log', ''); } // Preventing actual e-mail from being sent. $email = $this->getModelMock('ebayenterprise_magelog/logger_email', ['send']); $email->expects($this->any())->method('send')->will($this->returnSelf()); $this->replaceByMock('model', 'ebayenterprise_magelog/logger_email', $email); }
protected function setUp() { parent::setUp(); $this->helper = Mage::helper('helpdesk/mail'); $this->helper->emails = array(); $this->markTestSkipped('We don"t use this testclass.'); }
public function setUp() { parent::setUp(); $payment = Mage::getModel('sales/order_payment'); $payment->setAdditionalInformation('CC_BRAND', 'VISA'); $this->testObjects[] = Mage::getModel('ops/payment_cc')->setInfoInstance($payment); $this->testObjects[] = Mage::getModel('ops/payment_directDebit'); }
protected function tearDown() { $collection = $this->getTestCronScheduleCollection(); foreach ($collection as $item) { $item->delete(); } parent::tearDown(); }
public function setUp() { parent::setUp(); $this->_context = Mage::helper('ebayenterprise_magelog/context'); // suppressing the real session from starting $session = $this->getModelMockBuilder('core/session')->disableOriginalConstructor()->setMethods(null)->getMock(); $this->replaceByMock('singleton', 'core/session', $session); }
public function setUp() { parent::setUp(); $this->shipping = Mage::getModel('shipping/shipping'); $this->observer = $this->getModelMock('checkoutrule/observer', array('shippingMethods')); $this->observer->expects($this->any())->method('shippingMethods')->will($this->returnCallback(array($this, 'processShippingMethods'))); $this->replaceByMock('model', 'checkoutrule/observer', $this->observer); }
/** * Set up controller params * (non-PHPdoc) * @see EcomDev_PHPUnit_Test_Case::setUp() */ protected function setUp() { EcomDev_PHPUnit_Test_Case::setUp(); $this->reset(); //$this->registerCookieStub(); fix exception $this->getCookies()->reset(); $this->app()->getFrontController()->init(); }
public function setUp() { parent::setUp(); $this->_data = Mage::getModel('productquestions/productquestions'); $this->_sess = Mage::getSingleton('core/session'); $this->_customersess = Mage::getSingleton('customer/session'); $this->_adminUrl = Mage::getSingleton('adminhtml/url'); $this->_resource = Mage::getModel('productquestions/productquestions')->getResource(); }
protected function setUp() { parent::setUp(); $this->helper = Mage::helper('helpdesk/process'); $this->mockConfigMethod(array('getDefaultStatus' => 1, 'getContactFormDefaultDepartment' => 2, 'getDefaultPriority' => 3, 'getNotificationIsShowCode' => true)); if (!Mage::registry('isSecureArea')) { Mage::register('isSecureArea', true); } }
protected function setUp() { parent::setUp(); $resource = Mage::getSingleton('core/resource'); $con = $resource->getConnection('core_write'); $con->query("delete from {$resource->getTableName('helpdesk/email')}"); $this->helper = Mage::helper('helpdesk/fetch'); $this->mailbox = $this->createMailbox('test-message'); }
/** * Set up test class */ protected function setUp() { parent::setUp(); $this->_model = Mage::getModel('debit/debit'); $infoInstance = Mage::getModel('payment/info'); $infoInstance->setMethod($this->_model->getCode()); $infoInstance->setMethodInstance($this->_model); $this->_model->setData('info_instance', $infoInstance); }
/** * Set up AOP tests. * * @return void */ public function setUp() { parent::setUp(); // Make sure the AspectKernel is always initialized. Danslo_Aop_Model_Observer::initializeAspectKernel(); // Because fixtures can change for every test, reconfigure AOP // with possibly new aspects. $kernel = Danslo_Aop_Aspect_Kernel::getInstance(); $kernel->configureAop($kernel->getContainer()); }
public function tearDown() { $collection = $this->getProductSyncCronScheduleCollection(); foreach ($collection as $item) { $item->delete(); } $resource = Mage::getModel("core/resource"); $resource->getConnection("core_write")->delete($resource->getTableName("klevu_search/order_sync")); parent::tearDown(); }
public function tearDown() { $collection = $this->getProductSyncCronScheduleCollection(); foreach ($collection as $item) { $item->delete(); } $resource = Mage::getModel("core/resource"); $resource->getConnection("core_write")->delete($resource->getTableName("klevu_search/order_sync")); EcomDev_Utils_Reflection::setRestrictedPropertyValue(Mage::getConfig(), "_classNameCache", array()); parent::tearDown(); }
public function setUp() { parent::setup(); $this->_helper = Mage::helper('ops/directlink'); $transaction = Mage::getModel('sales/order_payment_transaction'); $transaction->setAdditionalInformation('arrInfo', serialize(array('amount' => '184.90'))); $transaction->setIsClosed(0); $this->_transaction = $transaction; $this->_order = Mage::getModel('sales/order'); $this->_order->setGrandTotal('184.90'); $this->_order->setBaseGrandTotal('184.90'); }
protected function setUp() { parent::setUp(); $this->model = Mage::getModel("pinpay/paymentMethod"); $this->assertInstanceOf('Dwyera_Pinpay_Model_PaymentMethod', $this->model); $this->_mockSessionCookie('customer/session'); $this->_mockSessionCookie('admin/session'); $this->_mockSessionCookie('adminhtml/session'); $this->_mockSessionCookie('core/session'); $this->_mockSessionCookie('checkout/session'); Mage::unregister('_singleton/eav/config'); }
protected function setUp() { Mage::getSingleton('core/resource')->getConnection('core_write')->query('delete from catalog_product_entity'); $model = Mage::getModel('eav/entity_setup', 'core_setup'); $attributeId = $model->getAttribute('catalog_product', 'color'); $attributeSetId = $model->getDefaultAttributeSetId('catalog_product'); //Get attribute group info $attributeGroupId = $model->getAttributeGroup('catalog_product', $attributeSetId, 'General'); //add attribute to a set $model->addAttributeToSet('catalog_product', $attributeSetId, $attributeGroupId['attribute_group_id'], $attributeId['attribute_id']); parent::setUp(); }
public function setUp() { parent::setUp(); $this->parseHelper = Mage::helper('seo/parse'); //we load product from collection, because we need to load its attributes $collection = Mage::getModel('catalog/product')->getCollection()->addFieldToFilter('entity_id', 1)->addAttributeToSelect('*'); $product = $collection->getFirstItem(); $category = Mage::getModel('catalog/category')->load(2); $store = Mage::getModel('core/store')->load(2); $category->setMetaTitle('Category meta title'); $this->objects = array('product' => $product, 'category' => $category, 'store' => $store); }
/** * Mock session singletons, set default store and fix session problems. */ protected function setUp() { parent::setUp(); // mock core session $mockCoreSession = $this->getModelMockBuilder('core/session')->disableOriginalConstructor()->setMethods(null)->getMock(); $this->replaceByMock('singleton', 'core/session', $mockCoreSession); // mock checkout session $mockCheckoutSession = $this->getModelMockBuilder('checkout/session')->disableOriginalConstructor()->setMethods(null)->getMock(); $this->replaceByMock('singleton', 'checkout/session', $mockCheckoutSession); $this->app()->setCurrentStore('default'); // somehow needed to avoid exceptions of type "Cannot send session cookie - headers already sent by" @session_start(); }
protected function tearDown() { $this->getConfig()->deleteConfig("klevu_search/general/enabled"); $this->getConfig()->deleteConfig("klevu_search/general/js_api_key"); $this->getConfig()->deleteConfig("klevu_search/general/rest_api_key"); $this->getConfig()->deleteConfig("klevu_search/product_sync/enabled"); $this->getConfig()->deleteConfig("klevu_search/product_sync/frequency"); $this->getConfig()->deleteConfig("klevu_search/attributes/additional"); $this->getConfig()->deleteConfig("klevu_search/order_sync/enabled"); $this->getConfig()->deleteConfig("klevu_search/order_sync/frequency"); $this->getConfig()->deleteConfig("klevu_search/developer/force_log"); $this->getConfig()->deleteConfig("klevu_search/developer/log_level"); parent::tearDown(); }
/** * Set up controller params */ protected function setUp() { /** * Mock session to avoid BUG * "Exception: Warning: session_start(): Cannot send session cookie - headers already sent by" */ $sessionMock = $this->getModelMock('customer/session', array('init', 'renewSession', 'start')); $this->replaceByMock('model', 'customer/session', $sessionMock); $sessionMock = $this->getModelMock('checkout/session', array('init', 'renewSession', 'start')); $this->replaceByMock('model', 'checkout/session', $sessionMock); //Basic Setup $this->store = Mage::app()->getStore(0)->load(0); $_baseUrl = Mage::getStoreConfig('web/unsecure/base_url'); $this->app()->getRequest()->setBaseUrl($_baseUrl); parent::setup(); }
protected function setUp() { parent::setUp(); $this->helper = Mage::helper('mstcore/urlrewrite'); $this->helper->rewriteMode('MOD', true); $this->helper->registerBasePath('MOD', 'kbp'); $this->helper->registerPath('MOD', 'ARTICLE', '[category_key]/[article_key]', 'kb_article_view'); $this->helper->registerPath('MOD', 'CATEGORY', '[category_key]', 'kb_category_view'); $this->helper->registerPath('MOD', 'TAG_LIST', 'tags', 'kb_tag_index'); $this->category = new Varien_Object(); $this->category->setId(2)->setUrlKey('category_2'); $this->article = new Varien_Object(); $this->article->setId(4)->setUrlKey('article_4'); $this->helper->updateUrlRewrite('MOD', 'CATEGORY', $this->category, array('category_key' => $this->category->getUrlKey())); $this->helper->updateUrlRewrite('MOD', 'ARTICLE', $this->article, array('category_key' => $this->category->getUrlKey(), 'article_key' => $this->article->getUrlKey())); }
protected function setUp() { parent::setUp(); // setting up a valid address, only test for street validation later $this->model = Mage::getModel('dhlaccount/quote_address'); $this->model->setFirstname('Homer J.'); $this->model->setLastname('Simpson'); $this->model->setCity('Springfield'); $this->model->setPostcode('4711'); $this->model->setTelephone('0815'); $this->model->setRegionId('Somewhere'); $this->model->setCountryId(1); $this->model->setAddressType(Dhl_Account_Model_Quote_Address::TYPE_BILLING); $this->store = Mage::app()->getStore(0)->load(0); $this->store->setConfig('intraship/dhlaccount/active', true); $this->store->setConfig('intraship/packstation/active', true); }
/** * Unset everything before the next test. */ protected function tearDown() { unset($this->object); parent::tearDown(); }
public function setUp() { parent::setUp(); $this->model = Mage::getModel('ops/payment_openInvoiceNl'); }