Category: Vargant

  • Symlinks on VVV

    Symlinks on VVV

    Trying to use outside symlinks in a WordPress environment can be a headache.

    If you are using VVV and want to create a symlink (for example, in order to have your plugins folder outside the Vagrant installation), the following is a way to do it.

    Go to your ./Vagrantfile and add the following code:

    if vagrant_version >= "1.3.0"
       config.vm.synced_folder "/Users/path/to/your/plugins/folder/", "/srv/www/wordpress-one/wp-content/plugins", :owner => "www-data", :mount_options => [ "dmode=775", "fmode=774" ]
     else
       config.vm.synced_folder "/Users/path/to/your/plugins/folder/", "/srv/www/wordpress-one/wp-content/plugins", :owner => "www-data", :extra => 'dmode=775,fmode=774'
     end

    Details:

    • In the ./Vagrantfile you should use the param: config.vm.synced_folder
    • The first path should point to the folder where you want to keep your plugins
    • The second path should point to the Vagrant folder that has the plugins
  • PHPUnit on VVV

    PHPUnit on VVV

    If you are developing something for WooCommerce Admin, you will probably want to use PHPUnit. If you are using Vagrant, you will already have everything ready to get started.

    These are some steps to run PHPUnit on a VVV instance.

    1 – SSH into a running Vagrant machine (more info) with this command:

    $ vagrant ssh [instance id]

    2 – Go to the plugin’s folder with this command:

    $ cd /srv/www/wordpress-one/public_html/wp-content/plugins/woocommerce-admin

    3 – Update composer:

    $ composer update

    4 – Execute tests:

    $ vendor/bin/phpunit

    4.1 – Install tests if it’s necessary, running:

    $ bin/install-wp-tests.sh 'wordpress-one-test' 'wp' 'wp' 'localhost' '5.3.2' 'true' //dbname=wordpress-one-test user=wp password=wp host=localhost wp-version=5.3.2 skip-database-creation=true

    And try step 4 again.