/** * Initializes model under test and disables events * for checking logic in isolation from custom its customizations * * (non-PHPdoc) * @see EcomDev_PHPUnit_Test_Case::setUp() */ protected function setUp() { parent::setUp(); $this->model = Mage::getModel('getfinancing/paymentMethod'); $this->app()->disableEvents(); $this->getfinancing = new GetFinancing_Magento($this->model); }
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)); }
/** * 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.'); }
/** * 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->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); }
/** * Sets everything for a new test. parent::setUp() is necessary to enable fixtures. */ protected function setUp() { parent::setUp(); $this->object = new ZerebroInternet_Barzahlen_Model_Adminexceptions_Maxordertotal(); $this->object->setScope('default'); $this->object->setScopeId(0); $this->object->setPath('payment/barzahlen/max_order_total'); }
/** * 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->_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); }
/** * Sets everything for a new test. parent::setUp() is necessary to enable fixtures. */ protected function setUp() { parent::setUp(); $this->object = new ZerebroInternet_Barzahlen_Model_Adminexceptions_Paymentkey(); $this->object->setScope('default'); $this->object->setScopeId(0); $this->object->setPath('payment/barzahlen/payment_key'); }
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 setUp() { parent::setUp(); $this->_removeAttribute(); $this->_addAttribute(); $this->_block = $this->app()->getLayout()->createBlock('adminhtml/catalog_product_attribute_edit_tab_options'); $this->app()->addEventArea('adminhtml'); }
/** * 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); }
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 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()); }
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); }
public function setUp() { parent::setUp(); $collection = $this->getProductSyncCronScheduleCollection(); foreach ($collection as $item) { $item->delete(); } $collection = $this->getOrderSyncCronScheduleCollection(); foreach ($collection as $item) { $item->delete(); } }
/** * 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 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); }
public function setUp() { parent::setUp(); $this->openInvoiceNlModel = Mage::getModel('ops/backend_operation_refund_additional_openInvoiceNl'); $invoice = Mage::getModel('sales/order_invoice'); // add first item to invoice $item = Mage::getModel('sales/order_invoice_item'); $orderItem = Mage::getModel('sales/order_item'); $orderItem->setId(1); $orderItem->setQtyOrdered(2); $item->setOrderItemId(1); $item->setOrderItem($orderItem); $item->setName('Item 1'); $item->setBasePriceInclTax(42.99); $item->setQty(2); $item->setTaxPercent(19); $invoice->addItem($item); // add second item to invoice $orderItem = Mage::getModel('sales/order_item'); $orderItem->setId(2); $orderItem->setQtyOrdered(2); $item = Mage::getModel('sales/order_invoice_item'); $item->setOrderItemId(2); $item->setOrderItem($orderItem); $item->setName('Item 2'); $item->setBasePriceInclTax(19.99); $item->setQty(2); $item->setTaxPercent(7); $invoice->addItem($item); // add shipping and discount $invoice->setBaseShippingInclTax(10.0); $order = Mage::getModel('sales/order'); $order->setShippingDescription('SuperFunShipping'); $payment = Mage::getModel('sales/order_payment'); $payment->setMethod('ops_openInvoiceNl'); $order->setPayment($payment); $invoice->setOrder($order); $this->testInvoice = $invoice; $sessionMock = $this->getModelMockBuilder('adminhtml/session_quote')->disableOriginalConstructor()->setMethods(null)->getMock(); $this->replaceByMock('singleton', 'adminhtml/session_quote', $sessionMock); $sessionMock = $this->getModelMockBuilder('checkout/session')->disableOriginalConstructor()->setMethods(null)->getMock(); $this->replaceByMock('singleton', 'checkout/session', $sessionMock); $sessionMock = $this->getModelMockBuilder('customer/session')->disableOriginalConstructor()->setMethods(null)->getMock(); $this->replaceByMock('singleton', 'customer/session', $sessionMock); }
/** * Sets everything for a new test. parent::setUp() is necessary to enable fixtures. */ public function setUp() { parent::setUp(); $this->object = Mage::getModel('barzahlen/api_request_payment'); }
public function setUp() { parent::setUp(); $this->model = Mage::getModel('ops/payment_openInvoiceNl'); }
public function setUp() { parent::setUp(); $this->_data = Mage::getModel('productquestions/urlrewrite'); }
public function setUp() { parent::setUp(); }
protected function setUp() { parent::setUp(); }