![]() ![]() Head over to to download the latest version of WordPress. Remember what you named your password, you will need to know what that name is when you install WordPress. Set the collation to “utf8_general_ci” or the utf8 setting that matches your language. On the right side under “Databases” it will say create database with a form field that says “Database name” enter a name in that field. ![]() You can also alternatively click on the database tab on the right side of the page. At the very top of that is a button that says new. On the left hand side of the phpMyAdmin page there is a database tree. On the MAMP start page click on tools > phpMyAdmin. Every WordPress site needs it’s own database file. Things like your posts, user and pages are all stored in a database file. WordPress needs a place to store the data that you create for your site. If you scroll down on that page you will find the information about your MySQL user name and password. Once the green Apache and MySQL server lights are on you can test that your localhost server is functioning by clicking on the “Open Start Page” button in the MAMP window.Ī MAMP page should open up wit the address localhost/mamp/ $ sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.Step 3: Get your MySQL Username and Password To fix this, create a symbolic link between the socket in /var/mysql to the socket provided my MAMP: $ sudo mkdir /var/mysql If you happen to get an error, it’s likely because the WordPress Tests attempt to use the mysql socket located in /var/mysql on the local machine, but if you’re using MAMP, then the location of the socket doesn’t exist. Assuming that you’ve setup the symbolic link to PHPUnit as covered above, you can test, for example, the user capabilities by running: $ phpunit tests/test_user_capabilities.php Once done, you can begin issuing commands to execute the WordPress tests. ![]() For example, if they are running in the root of the WordPress installation then you’re good to go, but if you have them running in, say, a theme directory, you’ll need to locate the following line in wp-tests-config.php: define( 'ABSPATH', dirname( _FILE_ ). Make sure that you use a database that you don’t mind destroying as the tests will create and empty tables during the course of their execution.ĭepending on where you’ve installed the WordPress Tests, you may need to update the path to WordPress. The easiest way to setup the rests is to drop the wordpress-tests directory in the root of the WordPress installation directory.Īfter that, update the wp-tests-config-sample.php just as you would a standard wp-config.php file. You can grab a copy of the code from the Subversion repository and either clone or extract a downloaded archive. Installing the WordPress Tests is relatively easy. This will allow you to run ‘phpunit’ in any terminal session: $ sudo ln -s /Applications/MAMP/bin/php/php5.3.6/bin/phpunit /usr/local/bin/phpunit Install The WordPress Tests If you’re interested in creating a symbolic link to the pear installation, run the following command. Next, tell Pear to use repositories that we specify in the command line: $ sudo /Applications/MAMP/bin/php/php5.3.6/bin/pear config-set auto_discover 1įinally, install PHPUnit: $ sudo /Applications/MAMP/bin/php/php5.3.6/bin/pear install /PHPUnit The problem is that Pear’s configuration file is out of date – this just moves it to a file with a different name. If you experience this, run the following command: $ mv /Applications/MAMP/bin/php/php5.3.6/conf/nf /Applications/MAMP/bin/php/php5.3.6/conf/ In the comments, Japh noted that the received an error when trying to run Pear. In a terminal session, issue the following command: $ cd /Applications/MAMP/bin/php/php5.3.6/bin It’s included with MAMP, but you’ll likely need to update it. To install PHPUnit, you’ll need to use Pear. Here are the steps necessary to install PHPUnit and the WordPress Tests on Mac OS X using MAMP: Because I use MAMP for local development, I had to do some additional customization to get the frameworks setup. Obviously, this requires an installation of PHPUnit and the WordPress testing framework. I’ve begun using PHPUnit, WordPress, and MAMP to introduce unit testing to my theme and plugin development. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |