Magento Mamp



  1. Magento Sample Sites
  2. Magento Mamp Tutorial
  3. Magento Cron Job Mamp

I’m using the latest version of Magenta 1.6.2.0 on running on MAMP Pro. I tried to follow your instructions above even though i think it is on an older version of Magento. It was worth a shot as i feel like i’ve tried every option. You seem have a good knowledge of Magento/MAMP, do you know of the top of your head what i seem to be doing wrong?

Running all unit tests

To run all tests, navigate to the Magento base directory and execute the following command:

  1. MAMP for Windows MAMP is a free, local server environment that can be installed under macOS and Windows with just a few clicks. MAMP provides them with all the tools they need to run WordPress on their desktop PC for testing or development purposes, for example. You can even easily test your projects on mobile devices.
  2. Magento 2 NGINX config for MAMP Pro. GitHub Gist: instantly share code, notes, and snippets.
  3. Next step is to make mamp support HTTP/2 and make Magento 2 even faster on local. A huge thank you for those who replied earlier. Your answers helped me to solve some parts of the puzzle. I'm glad to be sharing the whole solution with you now. If it doesn't work for you, keel an eye on MAMP Nginx log.
  4. Next step is to make mamp support HTTP/2 and make Magento 2 even faster on local. A huge thank you for those who replied earlier. Your answers helped me to solve some parts of the puzzle. I'm glad to be sharing the whole solution with you now. If it doesn't work for you, keel an eye on MAMP Nginx log.

Running only a subset of the unit tests

To run only tests within a specific directory branch, all you have to do is to specify the directory branch after the command.

Magento sample sites

Magento Sample Sites

The following example tells PHPUnit to look for any file ending with Test.php within the directory branch app/code/Example/Module/Test/Unit and try to execute it.

Explanation

The phpunit executable is installed by composer and linked into the directory vendor/bin.

The option -c dev/tests/unit/phpunit.xml.dist specifies the configuration file for PHPUnit.

If custom configuration settings are required (more on that later), the file dev/tests/unit/phpunit.xml.dist can be copied to dev/tests/unit/phpunit.xml and adjusted as needed. In that case modify the -c flag accordingly.

PHPUnit has many additional command line options. Please refer to the PHPUnit documentation for more information (currently Magento 2 uses PHPUnit version 4.1.0, Magento 2.2.x uses PHPUnit vesrsion 6.x).

Solutions to common problems

Permission Denied

One possible reason for this to happen might be if you are trying to execute PHPUnit inside a Virtual Box VM with shared folders that don’t allow modifying permissions.

Whatever the reason, if you encounter the permission denied: vendor/bin/phpunit error, you can prefix the command with the PHP interpreter, so your system knows what binary to use to run the tests.

Use the correct PHP interpreter

On many development systems, you might have more one PHP version installed. You must know the correct PHP interpreter to use for testing; that is, use the same version of PHP to run the unit tests you use to run Magento.

Some examples follow:

  • Ubuntu: /usr/bin/php
  • CentOS: /usr/bin/php
  • OS X:

    • System: /usr/bin/php
    • Homebrew: /usr/local/Cellar/php56/5.6.19/bin/php
    • MAMP: /Applications/MAMP/bin/php/php5.6.19/bin/php

You can either fix your $PATH (please refer to your system documentation on how to do that), or specify the full path to the PHP interpreter. For example:

Memory Limit

If you encounter an error similar to Fatal error: Allowed memory size of 67108864 bytes exhausted, follow these steps to resolve it.

Copy the PHPUnit configuration file dev/tests/unit/phpunit.xml.dist to dev/tests/unit/phpunit.xml

Magento Mamp Tutorial

Magento

Find the following section:

Magento Cron Job Mamp

Add the following line in the <php> block to disable the PHP memory limit during test execution.