Performance Improvement Running PHPUnit

We’re using PHPUnit to add integration and unit tests at work and normally when I want to test a single I use --filter to pick just the one I want:

vagrant@precise64:/var/www$ vendor/bin/phpunit -c tests --filter UserTest::testLoginWithInvalidPassword
PHPUnit 3.7.31 by Sebastian Bergmann.

Configuration read from /var/www/tests/phpunit.xml


Time: 6.82 seconds, Memory: 17.25Mb

OK (7 tests, 7 assertions)

Almost 7 seconds for 7 tests is a lot…

When I just just --filter PHPUnit is loading all the other unit test classes and then running just the ones that match the --filter. By specifiying the file I want to run the test from I can get better performance:

vagrant@precise64:/var/www$ vendor/bin/phpunit -c tests --filter UserTest::testLoginWithInvalidPassword tests/models/UserTest.php
PHPUnit 3.7.31 by Sebastian Bergmann.

Configuration read from /var/www/tests/phpunit.xml


Time: 4.84 seconds, Memory: 12.50Mb

OK (7 tests, 7 assertions)

I’m sure for any PHPUnit masters this is old information but I’ve never seen it so I thought others might find it interesting.

Link Post: Why We (Still) Believe in Private Offices

Open plans have been surprisingly hard to kill, despite research showing that they’re unpopular, decrease employee satisfaction, and hurt productivity. The response so far seems to have been to double down and make it, if anything, worse: cubicles are now decidedly un-cool so no-wall open offices are all the rage, and Facebook brags that its new building will be the largest open floor plan in the world, consisting of a single, ten acre open room.

I’ve worked in a cube farm and a room where they jammed in six desks and computers. Working in an open area can be super annoying when the person next to you is loud, messy, and/or smells.

I’m most productive working from home and highly recommend people who can do work remotely.

Link Post: The 7 Rules for Writing Software That Won’t Die When You Do

Similarly, it is important to know when you are writing bad software. Here’s a few questions that will help us diagnose if you are writing bad software.

  1. Does pushing updates to the software take a lot of time and effort?
  2. Does the whole system go down when you push a very small change?
  3. Have you ever pushed broken code to production, and didn’t realize until your users started complaining?
  4. Do you know what exactly to do when your system goes down — how to dig into backups, and deploy them?
  5. Are you spending more time on things like moving between environments, or running the same commands again and again, or running small utilities than actually making the software?

If you answered yes to any of these questions, this post is for you. Read all the way through, at least twice.

Fixing the “mkmf.rb can’t find header files for ruby at /usr/lib/ruby/ruby.h” error on CentOS

I was trying to install compass on one of my VMs the other day and I ran into this error:

[vagrant@unknown080027e8e390 public]$ sudo gem install compass
Building native extensions.  This could take a while...
ERROR:  Error installing compass:
        ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/ffi-1.9.6 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/ffi-1.9.6/ext/ffi_c/gem_make.out

The quickfix for this is to install the ruby development package:

sudo yum -y install ruby-devel

I’m not sure why CentOS doesn’t install this with rubygems…

Link Post: You May Be Losing Users If Responsive Web Design Is Your Only Mobile Strategy

I’ve been trying to get my head around the idea of just pushing out the code that a mobile site would need and I find it interesting. I’m wondering if you could create a SASS file that would use conditionals instead of @media queries and then serve out the correct CSS file based on the script tag…