Skip to content

Instantly share code, notes, and snippets.

@gpaddis
Last active February 8, 2019 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gpaddis/191f7b8cee890be5de82e74df175ea2b to your computer and use it in GitHub Desktop.
Save gpaddis/191f7b8cee890be5de82e74df175ea2b to your computer and use it in GitHub Desktop.
Deploy your Magento 1 module to a custom shop with modman and run the unit tests there with EcomDev_PHPUnit
#!/bin/bash
checkFileOrExitWithMessage() {
local filePath="$1"
local message="$2"
test -f $filePath || {
echo "$message"
exit 1
}
}
runDirectory=$PWD
moduleDirectoryName=${PWD##*/}
if [[ $# -ne 2 ]]; then
echo "Usage: $0 magento_directory module_group_name"
exit 1
fi
magentoDirectory="$1"
moduleGroupName="$2"
checkFileOrExitWithMessage "$magentoDirectory/app/Mage.php" "Could not find Magento in the directory $magentoDirectory."
checkFileOrExitWithMessage "$runDirectory/modman" "Could not find a modman file in $runDirectory. Are you in a module directory?"
test -d $magentoDirectory/.modman || {
echo "Initializing modman in the magento directory..."
modman init $magentoDirectory
}
test -d $magentoDirectory/.modman/$moduleDirectoryName || {
echo "Deploying the module to the Magento directory..."
ln -s $runDirectory $magentoDirectory/.modman/$moduleDirectoryName
cd $magentoDirectory
modman deploy $moduleDirectoryName
n98-magerun.phar sys:setup:run
}
cd $magentoDirectory
vendor/bin/phpunit --group $moduleGroupName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment