Add phase at position

Implement the following methods for adding new phases at a given
position:

  - `phases.addAt(index, phase)`
  - `phases.addBefore(name, phase)`
  - `phases.addAfter(name, phase)`

The first commit cleans up the unit tests.

/to @ritch please review