Created
October 15, 2011 12:17
-
-
Save cmuench/1289481 to your computer and use it in GitHub Desktop.
Magento 2 Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Auszug aus der Datei AreaTest.php im Verzeichnis dev/tests/integration/testsuite/Mage/Core/Model/App | |
* Im Test wird doe Store-Config über einen DocBlock definiert. | |
*/ | |
//... | |
/** | |
* @magentoConfigFixture current_store design/theme/full_name default/default/blank | |
* @magentoAppIsolation enabled | |
*/ | |
public function testDetectDesignStoreConfig() | |
{ | |
$this->_model->detectDesign(); | |
$this->assertEquals('default/default/blank', Mage::getDesign()->getAreaParameters()); | |
} | |
//... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//.... | |
/* @var $installer Mage_Catalog_Model_Resource_Resource_Setup */ | |
$installer = $this; | |
// Create Root Catalog Node | |
createObject('Mage_Catalog_Model_Category') | |
->load(1) | |
->setId(1) | |
->setStoreId(0) | |
->setPath(1) | |
->setLevel(0) | |
->setPosition(0) | |
->setChildrenCount(0) | |
->setName('Root Catalog') | |
->setInitialSetupFlag(true) | |
->save(); | |
/* @var $category Mage_Catalog_Model_Category */ | |
$category = createObject('Mage_Catalog_Model_Category'); | |
$category->setStoreId(0) | |
->setName('Default Category') | |
->setDisplayMode('PRODUCTS') | |
->setAttributeSetId($category->getDefaultAttributeSetId()) | |
->setIsActive(1) | |
->setPath('1') | |
->setInitialSetupFlag(true) | |
->save(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Beispiel wir jetzt Kategorien geladen werden. | |
$category = createObject('Mage_Catalog_Model_Category') | |
->setStoreId(Mage::app()->getStore()->getId()) | |
->load($categoryId); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Auszug aus der ProductContorllerTest.php unter | |
* dev/tests/integration/testsuite/Mage/Catalog/controllers/ | |
*/ | |
//... | |
/** | |
* @magentoDataFixture Mage/Catalog/controllers/_files/products.php | |
*/ | |
public function testViewAction() | |
{ | |
$this->dispatch('catalog/product/view/id/1'); | |
/** @var $currentProduct Mage_Catalog_Model_Product */ | |
$currentProduct = Mage::registry('current_product'); | |
$this->assertInstanceOf('Mage_Catalog_Model_Product', $currentProduct); | |
$this->assertEquals(1, $currentProduct->getId()); | |
$lastViewedProductId = Mage::getSingleton('catalog/session')->getLastViewedProductId(); | |
$this->assertEquals(1, $lastViewedProductId); | |
/* Layout updates */ | |
$handles = Mage::app()->getLayout()->getUpdate()->getHandles(); | |
$this->assertContains('PRODUCT_TYPE_simple', $handles); | |
$this->assertContains('PRODUCT_1', $handles); | |
$responseBody = $this->getResponse()->getBody(); | |
/* Product info */ | |
$this->assertContains('Simple Product 1 Name', $responseBody); | |
$this->assertContains('Simple Product 1 Full Description', $responseBody); | |
$this->assertContains('Simple Product 1 Short Description', $responseBody); | |
/* Stock info */ | |
$this->assertContains('$1,234.56', $responseBody); | |
$this->assertContains('In stock', $responseBody); | |
$this->assertContains('Add to Cart', $responseBody); | |
/* Meta info */ | |
$this->assertContains('<title>Simple Product 1 Meta Title</title>', $responseBody); | |
$this->assertContains('<meta name="keywords" content="Simple Product 1 Meta Keyword" />', $responseBody); | |
$this->assertContains('<meta name="description" content="Simple Product 1 Meta Description" />', $responseBody); | |
} | |
//... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//.... | |
$installer = $this; | |
/* @var $installer Mage_Catalog_Model_Resource_Setup */ | |
$installer->startSetup(); | |
/** | |
* Create table 'catalog_product_entity' | |
*/ | |
$table = $installer->getConnection() | |
->newTable($installer->getTable('catalog_product_entity')) | |
->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array( | |
'identity' => true, | |
'unsigned' => true, | |
'nullable' => false, | |
'primary' => true, | |
), 'Entity ID') | |
->addColumn('entity_type_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array( | |
'unsigned' => true, | |
'nullable' => false, | |
'default' => '0', | |
), 'Entity Type ID') | |
->addColumn('attribute_set_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array( | |
'unsigned' => true, | |
'nullable' => false, | |
'default' => '0', | |
), 'Attribute Set ID') | |
->addColumn('type_id', Varien_Db_Ddl_Table::TYPE_TEXT, 32, array( | |
'nullable' => false, | |
'default' => Mage_Catalog_Model_Product_Type::DEFAULT_TYPE, | |
), 'Type ID') | |
->addColumn('sku', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array( | |
), 'SKU') | |
->addColumn('has_options', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array( | |
'nullable' => false, | |
'default' => '0', | |
), 'Has Options') | |
->addColumn('required_options', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array( | |
'unsigned' => true, | |
'nullable' => false, | |
'default' => '0', | |
), 'Required Options') | |
->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array( | |
), 'Creation Time') | |
->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array( | |
), 'Update Time') | |
->addIndex($installer->getIdxName('catalog_product_entity', array('entity_type_id')), | |
array('entity_type_id')) | |
->addIndex($installer->getIdxName('catalog_product_entity', array('attribute_set_id')), | |
array('attribute_set_id')) | |
->addIndex($installer->getIdxName('catalog_product_entity', array('sku')), | |
array('sku')) | |
->addForeignKey($installer->getFkName('catalog_product_entity', 'attribute_set_id', 'eav_attribute_set', 'attribute_set_id'), | |
'attribute_set_id', $installer->getTable('eav_attribute_set'), 'attribute_set_id', | |
Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) | |
->addForeignKey($installer->getFkName('catalog_product_entity', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), | |
'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', | |
Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) | |
->setComment('Catalog Product Table'); | |
$installer->getConnection()->createTable($table); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="<?php echo $this->getSkinUrl('Mage_Checkout::opcheckout.js') ?>"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<design> | |
<package code="default"> | |
<title>Default</title> | |
<theme version="2.0.0.0" code="default"> | |
<title>Default</title> | |
<requirements> | |
<magento_version from="2.0.0.0-dev1" to="*"/> | |
</requirements> | |
</theme> | |
</package> | |
</design> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment