diff --git a/.travis.yml b/.travis.yml index a4cc13d8f..a31371b6b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,12 +16,12 @@ php: env: - MAGENTO_VERSION="magento-mirror-1.4.2.0" DB=mysql INSTALL_SAMPLE_DATA=yes - MAGENTO_VERSION="magento-mirror-1.5.1.0" DB=mysql INSTALL_SAMPLE_DATA=yes - - MAGENTO_VERSION="magento-ce-1.6.2.0" DB=mysql INSTALL_SAMPLE_DATA=yes - - MAGENTO_VERSION="magento-ce-1.7.0.2" DB=mysql INSTALL_SAMPLE_DATA=yes - - MAGENTO_VERSION="magento-ce-1.8.1.0" DB=mysql INSTALL_SAMPLE_DATA=yes + - MAGENTO_VERSION="magento-mirror-1.6.2.0" DB=mysql INSTALL_SAMPLE_DATA=yes + - MAGENTO_VERSION="magento-mirror-1.7.0.2" DB=mysql INSTALL_SAMPLE_DATA=yes + - MAGENTO_VERSION="magento-mirror-1.8.1.0" DB=mysql INSTALL_SAMPLE_DATA=yes # Do not download sample data of 1.9 -> The file is too big - - MAGENTO_VERSION="magento-ce-1.9.0.1" DB=mysql INSTALL_SAMPLE_DATA=no - - MAGENTO_VERSION="magento-ce-1.9.1.1" DB=mysql INSTALL_SAMPLE_DATA=no + - MAGENTO_VERSION="magento-mirror-1.9.0.1" DB=mysql INSTALL_SAMPLE_DATA=no + - MAGENTO_VERSION="magento-mirror-1.9.1.1" DB=mysql INSTALL_SAMPLE_DATA=no - MAGENTO_VERSION="magento-mirror-1.9.2.1" DB=mysql INSTALL_SAMPLE_DATA=no - MAGENTO_VERSION="magento-mirror-1.9.2.2" DB=mysql INSTALL_SAMPLE_DATA=no @@ -30,10 +30,10 @@ matrix: exclude: # Newer Magento versions uses newer PHP versions - php: 5.3 - env: MAGENTO_VERSION="magento-ce-1.9.0.1" DB=mysql INSTALL_SAMPLE_DATA=no + env: MAGENTO_VERSION="magento-mirror-1.9.0.1" DB=mysql INSTALL_SAMPLE_DATA=no - php: 5.3 - env: MAGENTO_VERSION="magento-ce-1.9.1.1" DB=mysql INSTALL_SAMPLE_DATA=no + env: MAGENTO_VERSION="magento-mirror-1.9.1.1" DB=mysql INSTALL_SAMPLE_DATA=no - php: 5.3 env: MAGENTO_VERSION="magento-mirror-1.9.2.1" DB=mysql INSTALL_SAMPLE_DATA=no @@ -49,10 +49,10 @@ matrix: env: MAGENTO_VERSION="magento-mirror-1.5.1.0" DB=mysql INSTALL_SAMPLE_DATA=yes - php: 5.5 - env: MAGENTO_VERSION="magento-ce-1.6.2.0" DB=mysql INSTALL_SAMPLE_DATA=yes + env: MAGENTO_VERSION="magento-mirror-1.6.2.0" DB=mysql INSTALL_SAMPLE_DATA=yes - php: 5.5 - env: MAGENTO_VERSION="magento-ce-1.7.0.2" DB=mysql INSTALL_SAMPLE_DATA=no + env: MAGENTO_VERSION="magento-mirror-1.7.0.2" DB=mysql INSTALL_SAMPLE_DATA=no include: # Run the build script with an older PHP version - php: 5.3 diff --git a/build.sh b/build.sh index 7a7285f9a..ef347dc3e 100755 --- a/build.sh +++ b/build.sh @@ -22,7 +22,7 @@ BUILD_STATUS=$? php -f "n98-magerun.phar" -- --version -ls -go --full-time n98-magerun.phar +ls -l n98-magerun.phar php -r 'echo "SHA1: ", sha1_file("n98-magerun.phar"), "\nMD5.: ", md5_file("n98-magerun.phar"), "\n";' diff --git a/changes.txt b/changes.txt index 88fce4558..66053ac21 100644 --- a/changes.txt +++ b/changes.txt @@ -2,6 +2,15 @@ RECENT CHANGES ************** +====== +1.97.7 +====== + +* #724 Add missing versions from magento-mirror (by Fabrizio Branca) +* #722 Magento downloads are no longer working from magentocommerce.com (by Tom Klingenberg) +* #720 Add Info notice if dev:class:lookup returns a non-existent class (by Robbie Averill) +* Improve installer magento version switch argument parsing (by Tom Klingenberg) + ====== 1.97.6 ====== diff --git a/config.yaml b/config.yaml index 14979b7fb..340ef9e44 100644 --- a/config.yaml +++ b/config.yaml @@ -252,34 +252,88 @@ commands: - name: magento-mirror-1.9.2.0 version: 1.9.2.0 dist: - url: https://github.com/LokeyCoding/magento-mirror/archive/1.9.2.0.zip + url: https://github.com/OpenMage/magento-mirror/archive/1.9.2.0.zip type: zip shasum: 019538c04b6359ad61e4c6d2f54c835bd76f7141 extra: sample-data: sample-data-1.9.1.0 + - name: magento-mirror-1.9.1.1 + version: 1.9.1.1 + dist: + url: https://github.com/OpenMage/magento-mirror/archive/1.9.1.1.zip + type: zip + shasum: 3aa497d245affb273cc55851163f5133cecef650 + extra: + sample-data: sample-data-1.9.1.0 + + - name: magento-mirror-1.9.1.0 + version: 1.9.1.0 + dist: + url: https://github.com/OpenMage/magento-mirror/archive/1.9.1.0.zip + type: zip + shasum: e3dcfea601ada21ce84ee4836d801dd2feeb08d1 + extra: + sample-data: sample-data-1.9.1.0 + + - name: magento-mirror-1.9.0.1 + version: 1.9.0.1 + dist: + url: https://github.com/OpenMage/magento-mirror/archive/1.9.0.1.zip + type: zip + shasum: 9c87abc997957ebbf646e1a4d87d3d09e4d773f5 + extra: + sample-data: sample-data-1.9.0.0 + + - name: magento-mirror-1.9.0.0 + version: 1.9.0.0 + dist: + url: https://github.com/OpenMage/magento-mirror/archive/1.9.0.0.zip + type: zip + shasum: 98dc5a70d0d12fa595032a7e4257e9a8ee8e293c + extra: + sample-data: sample-data-1.9.0.0 + + - name: magento-mirror-1.8.1.0 + version: 1.8.1.0 + dist: + url: https://github.com/OpenMage/magento-mirror/archive/1.8.1.0.zip + type: zip + shasum: 3fbff399799177e8048cc4048f66213fedd132c1 + extra: + sample-data: sample-data-1.6.1.0 + + - name: magento-mirror-1.8.0.0 + version: 1.8.0.0 + dist: + url: https://github.com/OpenMage/magento-mirror/archive/1.8.0.0.zip + type: zip + shasum: 9b1dee54d0b047b66d7ad6b8ea1ff414b7773093 + extra: + sample-data: sample-data-1.6.1.0 + - name: magento-mirror-1.7.0.2 version: 1.7.0.2 dist: - url: https://github.com/LokeyCoding/magento-mirror/archive/1.7.0.2.tar.gz - type: tar - shasum: c10a3e15f9311c2b079bb2e71bacb32cb3192402 + url: https://github.com/OpenMage/magento-mirror/archive/1.7.0.2.zip + type: zip + shasum: e7f761d1ca60d16db867e24b5219de8815d0ea25 extra: sample-data: sample-data-1.6.1.0 - name: magento-mirror-1.6.2.0 version: 1.6.2.0 dist: - url: https://github.com/LokeyCoding/magento-mirror/archive/1.6.2.0.tar.gz - type: tar - shasum: 301b815359b8abd4dfcd828b261cd924d9868a19 + url: https://github.com/OpenMage/magento-mirror/archive/1.6.2.0.zip + type: zip + shasum: db0de6d0d82427d997a206554bcd7e5874099671 extra: sample-data: sample-data-1.6.1.0 - name: magento-mirror-1.5.1.0 version: 1.5.1.0 source: - url: git://github.com/LokeyCoding/magento-mirror.git + url: git://github.com/OpenMage/magento-mirror.git type: git reference: magento-1.5 extra: @@ -288,7 +342,7 @@ commands: - name: magento-mirror-1.4.2.0 version: 1.4.2.0 source: - url: git://github.com/LokeyCoding/magento-mirror.git + url: git://github.com/OpenMage/magento-mirror.git type: git reference: magento-1.4 extra: @@ -307,30 +361,30 @@ commands: - name: sample-data-1.9.1.0 version: 1.9.1.0 dist: - url: http://www.magentocommerce.com/downloads/assets/1.9.1.0/magento-sample-data-1.9.1.0.tar.gz + url: http://sourceforge.net/projects/mageloads/files/assets/1.9.1.0/magento-sample-data-1.9.1.0.tar.gz type: tar shasum: 617e0271900772ac8f11e7bb86e29fca0f640562 - name: sample-data-1.9.0.0 version: 1.9.0.0 dist: - url: http://www.magentocommerce.com/downloads/assets/1.9.0.0/magento-sample-data-1.9.0.0.tar.gz + url: http://sourceforge.net/projects/mageloads/files/assets/1.9.0.0/magento-sample-data-1.9.0.0.tar.gz type: tar shasum: b2b535901eb2db92a8602baf8a839ab2120c4c8f - name: sample-data-1.6.1.0 version: 1.6.1.0 dist: - url: http://www.magentocommerce.com/downloads/assets/1.6.1.0/magento-sample-data-1.6.1.0.tar.gz + url: http://sourceforge.net/projects/mageloads/files/assets/1.6.1.0/magento-sample-data-1.6.1.0.tar.gz type: tar shasum: a9226bc92966855327f6eb62ff8f6c562b2113a2 - name: sample-data-1.1.2 version: 1.1.2 dist: - url: http://www.magentocommerce.com/downloads/assets/1.1.2/magento-sample-data-1.1.2.tar.bz2 - type: tar - shasum: e8ddbf94698224fb71c946e789f7a23dec236384 + url: http://sourceforge.net/projects/mageloads/files/assets/1.1.2/magento-sample-data-1.1.2.zip + type: zip + shasum: 6bbb57e387c59da2752fe013aadef6dcd3cd2b29 installation: pre-check: diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 4f619157d..df893d24e 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -12,8 +12,7 @@ stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" - stopOnSkipped="false" - strict="false"> + stopOnSkipped="false"> ./tests diff --git a/readme.rst b/readme.rst index 35587ccb5..637cbbfb0 100644 --- a/readme.rst +++ b/readme.rst @@ -1178,6 +1178,8 @@ Resolve/Lookup Class Names Resolves the given type and grouped class name to a class name, useful for debugging rewrites. +If the resolved class doesn't exist, an info message will be displayed. + .. code-block:: sh $ n98-magerun.phar dev:class:lookup @@ -1276,7 +1278,7 @@ Rewrite List Lists all registered class rewrites. -.. code-blocks:: sh +.. code-block:: sh $ n98-magerun.phar dev:module:rewrite:list [--format[="..."]] diff --git a/src/N98/Magento/Application.php b/src/N98/Magento/Application.php index ca814c4ca..59708f658 100644 --- a/src/N98/Magento/Application.php +++ b/src/N98/Magento/Application.php @@ -46,7 +46,7 @@ class Application extends BaseApplication /** * @var string */ - const APP_VERSION = '1.97.6'; + const APP_VERSION = '1.97.7'; /** * @var string diff --git a/src/N98/Magento/Command/Developer/ClassLookupCommand.php b/src/N98/Magento/Command/Developer/ClassLookupCommand.php index 19534ba0f..bf109fe34 100644 --- a/src/N98/Magento/Command/Developer/ClassLookupCommand.php +++ b/src/N98/Magento/Command/Developer/ClassLookupCommand.php @@ -39,6 +39,10 @@ protected function execute(InputInterface $input, OutputInterface $output) if ($this->initMagento()) { $resolved = $this->_getConfig()->getGroupedClassName($input->getArgument('type'), $input->getArgument('name')); $output->writeln(ucfirst($input->getArgument('type')) . ' ' . $input->getArgument('name') . " resolves to " . $resolved . ''); + + if (!class_exists('\\' . $resolved)) { + $output->writeln('Note: Class ' . $resolved . ' does not exist!'); + } } } } diff --git a/src/N98/Magento/Command/Installer/InstallCommand.php b/src/N98/Magento/Command/Installer/InstallCommand.php index a6dbc389e..fe21bc8ab 100644 --- a/src/N98/Magento/Command/Installer/InstallCommand.php +++ b/src/N98/Magento/Command/Installer/InstallCommand.php @@ -204,13 +204,11 @@ protected function selectMagentoVersion(InputInterface $input, OutputInterface $ if ($input->getOption('magentoVersion')) { $type = $input->getOption('magentoVersion'); - } elseif ($input->getOption('magentoVersionByName')) { - foreach ($this->commandConfig['magento-packages'] as $key => $package) { - if ($package['name'] == $input->getOption('magentoVersionByName')) { - $type = $key + 1; - break; - } + if ($type !== (string)(int)$type) { + $type = $this->getPackageNumberByName($type); } + } elseif ($input->getOption('magentoVersionByName')) { + $type = $this->getPackageNumberByName($input->getOption('magentoVersionByName')); } if ($type == null) { @@ -218,7 +216,43 @@ protected function selectMagentoVersion(InputInterface $input, OutputInterface $ } } - $this->config['magentoVersionData'] = $this->commandConfig['magento-packages'][$type - 1]; + $magentoPackages = $this->commandConfig['magento-packages']; + + $index = $type - 1; + if (!isset($magentoPackages[$index])) { + throw new InvalidArgumentException( + sprintf( + 'Invalid Magento package number %s, must be from 1 to %d.', var_export($type, true), + count($magentoPackages) + ) + ); + } + + $this->config['magentoVersionData'] = $magentoPackages[$index]; + } + + + /** + * @param $name + * + * @return int 1 or greater as the one-based package number, null on failure to resolve the name + */ + private function getPackageNumberByName($name) + { + // directly filter integer strings + if ($name === (string)(int)$name) { + return (int) $name; + } + + $magentoPackages = $this->commandConfig['magento-packages']; + + foreach ($magentoPackages as $key => $package) { + if ($package['name'] === $name) { + return $key + 1; + } + } + + return null; } /** diff --git a/tests/N98/Magento/Command/Developer/ClassLookupCommandTest.php b/tests/N98/Magento/Command/Developer/ClassLookupCommandTest.php index 0ea1b353c..c2c17384d 100644 --- a/tests/N98/Magento/Command/Developer/ClassLookupCommandTest.php +++ b/tests/N98/Magento/Command/Developer/ClassLookupCommandTest.php @@ -7,7 +7,17 @@ class ClassLookupCommandTest extends TestCase { - public function testExecute() + /** + * Test that the class lookup command resolves to the expected Magento class, and optionally + * whether it outputs a notice informing that the class doesn't exist + * @dataProvider classLookupProvider + * + * @param string $type Model, helper, block + * @param string $name Magento dev code + * @param string $expected Resolved class name + * @param bool $exists Whether the resolved class should exist + */ + public function testExecute($type, $name, $expected, $exists) { $application = $this->getApplication(); $application->add(new ClassLookupCommand()); @@ -17,11 +27,61 @@ public function testExecute() $commandTester->execute( array( 'command' => $command->getName(), - 'type' => 'model', - 'name' => 'catalog/product', + 'type' => $type, + 'name' => $name ) ); - $this->assertRegExp('/Mage_Catalog_Model_Product/', $commandTester->getDisplay()); + $output = $commandTester->getDisplay(); + $this->assertRegExp(sprintf('/%s/', $expected), $output); + + $existsAssertion = (!$exists) ? 'assertRegExp' : 'assertNotRegExp'; + $this->{$existsAssertion}(sprintf('/%s/', 'does not exist'), $output); + } + + /** + * Provide data for the class lookup testExecute() + * @return array + */ + public function classLookupProvider() + { + return array( + array( + 'type' => 'model', + 'name' => 'catalog/product', + 'expected' => 'Mage_Catalog_Model_Product', + 'exists' => true + ), + array( + 'type' => 'model', + 'name' => 'catalog/nothing_to_see_here', + 'expected' => 'Mage_Catalog_Model_Nothing_To_See_Here', + 'exists' => false + ), + array( + 'type' => 'helper', + 'name' => 'checkout/cart', + 'expected' => 'Mage_Checkout_Helper_Cart', + 'exists' => true + ), + array( + 'type' => 'helper', + 'name' => 'checkout/stolen_creditcards', + 'expected' => 'Mage_Checkout_Helper_Stolen_Creditcards', + 'exists' => false + ), + array( + 'type' => 'block', + 'name' => 'customer/account_dashboard', + 'expected' => 'Mage_Customer_Block_Account_Dashboard', + 'exists' => true + ), + array( + 'type' => 'block', + 'name' => 'customer/my_code_snippets', + 'expected' => 'Mage_Customer_Block_My_Code_Snippets', + 'exists' => false + ) + ); } } diff --git a/version.txt b/version.txt index dcbfcf76d..0cb4b8efc 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.97.6 +1.97.7