Two Meetups for May: Code Review Takes Two and WordPress’ 10th Anniversary Party

This coming month we have two great meetups scheduled.

Developer: Code Review Takes Two

Date & Time: Monday, May 13th at 6:30 pm

Ever wanted to become a better developer? One sure way: have your code reviewed. Code review can offer valuable perspective on how to write concisely, solve challenging problems, or make your architecture abstracted.

For this Developer meetup, Mike Bijon and Jeremy Ross will step up to show us how code review should be done. In addition to what you should look for as a reviewer, they’ll cover ways a review can be conducted and how feedback should be communicated.

Note: Due to limited space, we’re capping signups to 75. If you RSVP and realize later you can’t make the meetup, please change your status so someone else can attend.

WordPress’ 10th Anniversary Party

Date, Time & Location: Monday (Memorial Day), May 27th at 7 pm at The Green Dragon

WordPress is turning 10, and you’re invited! To celebrate the occasion, the WordPress Foundation is coordinating a global party on Monday, May 27th.

We’ll be kicking it Portland-style at the Green Dragon, 9th and Yamhill in SE. Come stop by at 7 pm or afterwards to regale WordPress times of yore. There’s no set agenda but, if we can get 50 people RSVP’d on the Meetup Everywhere page, we’ll have special 10th anniversary swag to hand out.

Hope to see you there!

Unit Testing Hack Day Recap

Yesterday, even though it was a beautiful Saturday afternoon, 15 of us gathered to level up our Unit Testing skills at the first PDXWP Hack Day.

After a couple of hours getting learned, we managed to ship:

To kick the day off, special guest Max Cutler introduced us to the many variants of unit testing. Check out his Speakerdeck for the full presentation.

Max emphasized writing unit tests to:

  • Verify your functionality. Does the code do what you want it to do?
  • Validate technical design. Code that’s easier to test is generally better code. Plus, tests document what you’re intending to do.
  • Protect against bugs. If you find a bug, both fix the bug and write tests to protect against the bug in the future.
  • Refactor with confidence. Core takes backwards compat seriously, so having unit tests to describe coverage makes it easier to change code.

Unit testing specifically tests individual methods and functions to confirm input equals expected output. Integration testing looks at the code from the users’ perspective — everything works as expected. In core’s test suite, most tests are integration tests.

Max walked us through how WordPress core uses PHPUnit for testing, with lots of concrete examples. Thanks to good work by Jeremy and Zack, most of us had the test suite up and running via Vagrant. Here’s one great reason to help increase core’s test coverage:

Mike Bijon then talked through including tests with your plugin. It can be difficult to know where to get started when you’re looking at a blank slate. 100% coverage is much more easily attainable when you’ve been writing tests from the beginning, or practicing test-driven development.

It can be much easier incorporating tests into your plugin by breaking it down:

  • WordPress doesn’t WOSD.
  • Your code loads.
  • Each method has a test.
  • Code coverage reports.

Fortunately, there’s a couple of easy ways to get started. wp-cli takes care of the busy work with a wp scaffold plugin-tests <plugin-name> command. This will add all of the necessary code to your plugin to start writing PHPUnit tests. It also includes a travis.yml file — all you need for basic Travis CI.

Thanks again to our speakers, and everyone who took time out of their Saturday afternoon to raise the knowledge.

Unit Test Hack Day Prep

On Saturday, April 27th, PDXWP is hosting a hack day focusing on unit testing. Max Cutler, who has contributed significantly to WordPress core unit tests, will be teaching the group about unit testing.

WordPress core unit tests are written using PHPUnit. While PHPUnit is not the only unit testing framework for PHP, it is what WordPress has adopted and therefore, our hack day will focus on PHPUnit.

One of the most frustrating aspects of PHPUnit is getting it set up in the first place. Ideally, we will spend our time on Saturday learning to write unit tests, discussing how to improve unit tests, and getting our projects to pass the tests. Hopefully, we will not spend our time trying to get PHPUnit configured.

To this end, I have stood on the giant shoulders of Jeremy Felt and 10up by adding PHPUnit and the WordPress core unit tests to their outstanding Varying Vagrant Vagrants (VVV) vagrant setup. Instead of painstakingly writing a tutorial on how to install PHPUnit on OS X, Linux and Windows (and then trying to work around difficulties with MAMP, WAMP, XAMPP, etc.), this vagrant setup will build a virtual environment for you to work with locally during the dev day.

Getting Setup

  1. Install Virtual Box .
  2. Install Vagrant.
  3. Add “192.168.50.4 local.wordpress.dev local.wordpress-trunk.dev” to your hosts file.
  4. Determine where you want to store your vagrant files. I store mine in “~/Vagrant” on OS X.
  5. Clone VVV to your hard drive with, “git clone git@github.com:10up/varying-vagrant-vagrants.git”.
  6. Move to the cloned directory (e.g., “cd varying-vagrant-vagrants”).
  7. Run “vagrant up”.

You will now see a lot of output from your terminal. The base box will be downloaded, the server will be created, and the provisioning script will be executed, which installs a LEMP stack with a WordPress installation and the core unit tests. This can take between 10-30 minutes and is highly dependent upon your download speed (read: don’t try this at Starbucks or on the hack day!).

To test if you have correctly setup the box, visit “http://local.wordpress-trunk.dev” in your browser. If everything installed properly, you should see an installation of WordPress with the Twenty Thirteen theme.

To learn more about this vagrant setup, you can read the box’s description read me.

Running Unit Tests

  1. In terminal, navigate to your clone of the VVV repo.
  2. Run “vagrant ssh”. You are now ssh-ed into the virtual machine.
  3. Run “cd /srv/www/wordpress-unit-tests”.
  4. Run “sudo phpunit”

You should now see a lot of output:

You are seeing the WordPress unit tests running! In order to not spoil the fun, I will let Max explain what is going on during our meetup!

Your Job

Your job is simple–get PHPUnit working before the hack day. We will all have a lot more fun if everyone is already setup in advance. We can then focus on writing tests instead of setup up the tool. If you have questions, please have at it below! We will be happy to help.

The Power of WordPress’ Roles and Capabilities Recap

Monday night brought Erick Hitter, Team Custom Lead at Automattic, to speak to just under 40 people in developer meetup about the Power of WordPress’ Roles and Capabilities. His presentation took two parts, which Erick has also conveniently posted for your reviewing pleasure:

Special thanks to Luke Woodward for recording, processing, and posting the video.

Three Meetups for April: Roles and Capabilities, Unit Testing and What’s Coming in WordPress 3.6

This coming month we have two three great meetups scheduled.

The Power of WordPress’ Roles and Capabilities

Date & Time: Monday, April 15th at 6:30 pm

WordPress’ roles seem simple enough on the surface, but behind the Administrator, Editor, and the other default roles is a powerful system that can be customized extensively. For April’s PDXWP Developer’s meetup, Erick Hitter, Lead of Team Custom at Automattic, is joining us to talk about WordPress roles and capabilities.

While some have said that other CMS’ have an advantage when it comes to security and customizing capabilities, Erick will demonstrate that that isn’t true. Starting with a walkthrough of how to modify existing roles and create new ones, he will then cover how to leverage custom roles in WordPress code. Finally, he will wrap up with a discussion of some powerful filters that will prove WordPress has a roles and capabilities system that is as flexible as the popular competitors often touted as having superior implementations.

Hack With Me: Unit and Behavioral Tests

Date & Time: Saturday, April 27th from 1 to 5 pm

Who’s up for spending an afternoon learning more about unit and behavioral tests, and writing some for core or their favorite plugin? We are!

Mike Bijon and Max Cutler will kick off the afternoon introducing unit tests, why they’re valuable, and how to write them. We’ll then spend a few hours writing our own, either for core or a plugin we admire. Our goal is for everyone attending to successfully finish at least one unit test.

A week or so prior to the 27th, Zack will post notes on how you’ll need to preconfigure your development environment with PHPUnit, etc.

What’s Coming in WordPress 3.6

Date & Time: Monday, April 29th at 6:30 pm

Version 3.6 of WordPress is slated for release on April 29th, 2013.

What changes have been made? What great new features are included? How will my site be affected? These are great questions! We will answer all of these and more in this month’s user meetup.

Michael Fields will walk us through some of the new features:

  1. New bundled theme Twenty Thirteen.
  2. A complete rewrite of the post format interface.
  3. Enhancements to the Custom Menu interface.

If you’ve got a fever and the only cure is WordPress this is a presentation you will not want to miss.

RSVP for all of these our Meetup page. Hope to see you there!

WordPress Portland – MemberMouse Needs a Customer Support Specialist!

This is a guest post from Eric Turnnessen, Founder of MemberMouse. If you’d like to make an announcement to the group, let us know.

MemberMouse is a premium WordPress membership plugin that allows our customers to accept payments, manage customers, deliver premium content in a password protected member’s area, track critical business metrics and more. Our company’s mission is to deliver a powerful and innovative platform that provides our customers with the tools they need to run and grow a profitable online business.

We’re looking to hire a Customer Support Specialist to help extend our world-class support. When someone signs up for MemberMouse they can be confident that they’re not only getting the best technology for their online business but they’re also getting a knowledgeable, friendly team they can reach out to when they need help.

Continue reading “WordPress Portland – MemberMouse Needs a Customer Support Specialist!”

April 3rd: Hang Out With 10up in Portland!

Hey Portland WordPressers!

Almost the entire 10up team is coming into Portland this week for an internal developer summit. As part of our schedule, we’re having a community social over at Green Dragon on Wednesday, April 3rd starting at 7 pm. We’d love to buy you a beer, hang out and talk WordPress and web development for a couple hours.

If you’re interested, head on over to our Eventbrite page and pick up a free ticket. Hope to see you there!