Example #1
0
 public function testCollection()
 {
     $collection = $this->_model->getCollection()->joinStore()->addDateFilter();
     /**
      * @todo fix and add addStoreFilter method
      */
     $this->assertEmpty($collection->getItems());
 }
Example #2
0
 /**
  * @magentoAppIsolation enabled
  * @magentoDataFixture Mage/Core/_files/design_change_timezone.php
  * @dataProvider loadChangeTimezoneDataProvider
  */
 public function testLoadChangeTimezone($storeCode, $storeTimezone, $storeUtcOffset)
 {
     if (date_default_timezone_get() != 'UTC') {
         $this->markTestSkipped('Test requires UTC to be the default timezone.');
     }
     $utcDatetime = time();
     $utcDate = date('Y-m-d', $utcDatetime);
     $storeDatetime = strtotime($storeUtcOffset, $utcDatetime);
     $storeDate = date('Y-m-d', $storeDatetime);
     if ($storeDate == $utcDate) {
         $expectedDesign = "{$storeCode}_today_design";
     } else {
         if ($storeDatetime > $utcDatetime) {
             $expectedDesign = "{$storeCode}_tomorrow_design";
         } else {
             $expectedDesign = "{$storeCode}_yesterday_design";
         }
     }
     $store = Mage::app()->getStore($storeCode);
     $store->setConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE, $storeTimezone);
     $design = new Mage_Core_Model_Design();
     $design->loadChange($store->getId());
     $actualDesign = $design->getDesign();
     $this->assertEquals($expectedDesign, $actualDesign);
 }
Example #3
0
<?php

/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    Magento
 * @package     Mage_Core
 * @subpackage  integration_tests
 * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
$storeId = Mage::app()->getAnyStoreView()->getId();
$change = new Mage_Core_Model_Design();
$change->setStoreId($storeId)->setDesign('default/modern/default')->setDateFrom('2001-01-01 01:01:01')->save();
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    Magento
 * @package     Mage_Core
 * @subpackage  integration_tests
 * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
$designChanges = array(array('store' => 'default', 'design' => 'default_yesterday_design', 'date' => '-1 day'), array('store' => 'default', 'design' => 'default_today_design', 'date' => 'now'), array('store' => 'default', 'design' => 'default_tomorrow_design', 'date' => '+1 day'), array('store' => 'admin', 'design' => 'admin_yesterday_design', 'date' => '-1 day'), array('store' => 'admin', 'design' => 'admin_today_design', 'date' => 'now'), array('store' => 'admin', 'design' => 'admin_tomorrow_design', 'date' => '+1 day'));
foreach ($designChanges as $designChangeData) {
    $storeId = Mage::app()->getStore($designChangeData['store'])->getId();
    $change = new Mage_Core_Model_Design();
    $change->setStoreId($storeId)->setDesign($designChangeData['design'])->setDateFrom($designChangeData['date'])->setDateTo($designChangeData['date'])->save();
}
Example #5
0
 /**
  * Validate the target against the loaded designs.
  * 
  * @param string                 $targetPath The target path.
  * @param Mage_Core_Model_Design $design     The current design change.
  * 
  * @return boolean
  */
 protected function _validatePath($targetPath, Mage_Core_Model_Design $design)
 {
     $availablePaths = array_filter(explode(',', $design->getTargetPath()));
     return empty($availablePaths) || in_array($targetPath, $availablePaths);
 }