PHP: Peridot and Propel

Wanted to share a little configuration I just finished making for some Peridot and Leo -based tests which work with Propel models.

A bunch of these tests write data to the database using the Propel models, and I need a clean slate DB before each test. I also need a clean slate HTTP session. Here’s some code ( from peridot.php ) that uses transactions to achieve that:

class MyScope extends Scope {
  function __construct( $emitter ) {
    $emitter->on( 'peridot.execute', function() {
      $this->conn = Propel::getConnection();
    } );

    $emitter->on( 'test.start', function() {
      // have to rollback and begin here.
      // it was unreliable when I rolled back on test.end
    } );
  private static function destroySession() {
    $_SESSION =[];

    // If it's desired to kill the session, also delete the session cookie.
    // Note: This will destroy the session, and not just the session data!
    if (ini_get("session.use_cookies")) {
      $params = session_get_cookie_params();
      setcookie(session_name(), '', time() - 42000,
        $params["path"], $params["domain"],
        $params["secure"], $params["httponly"]


return function($emitter) {
  $gmsScope = new GmsScope( $emitter );

  //add this scope into every suite
  $emitter->on('suite.start', function($test) use ($gmsScope) {

Start learning to become a web developer with the Flatiron School Prework

I ran across the Flatiron School of programming a while back, and I thought it was pretty cool. They have a “pre-work” list of resources for their web development course. I expect it is quite good.

I ran across Flatiron school when I listened to a podcast the founder of the school did. I think it is pretty inspiring.

OK, enjoy learning to program. I’m pretty excited for you!

p.s. This post was based on an email reply I wrote to a reader of this blog who asked me for some resources to start learning Ruby on Rails.

“CSS for Beginners: How to style your website using CSS” – this Saturday

If you’ve been looking to learn how to use CSS, and you’re in Winnipeg, come out to a workshop that will teach you just that, this Saturday.

The workshop is put on by the great people behind Ladies Learning Code, so you can be sure that the atmosphere will be great, and your teachers and peers supportive.

Let me know what you learned if you go.

WinniVote Rspec Feature Tests

I spent several hours today creating the specs for WinniVote’s signup feature.

I feel it is a valuable investment of my time for several reasons:

  • WinniVote’s current tests do not feel high quality, so hopefully my examples help other WinniVote devs.
  • I’ve been thinking about what quality tests look like for a while now, but have not had a chance to get feedback from other developers, so I’m interested what others think about my style.
  • I look forward to the further evolution of my style based on the feedback I might receive.

Working with Laravel, or “Stay out of my way, but be there for me”

I got the opportunity to work with the Laravel framework on a new piece of software we are writing at work.

My favorite part so far is that I’ve managed to stay away from things I don’t yet need, like ORM/migrations and controllers-as-classes, while at the same time things like routing or caching were available for me when I needed them. If you’re interested at peeking at how I am using it, let me know.

I think my ideal framework at this moment would have all the pieces turned off, but available for me to turn on when I decide I want to use them.

Jaquilyn Shumate Photography Website

Check out this photo story about birth, part of the story-rich Jaquilyn Shumate blog.

This is featured on the website I implemented for Jaquilyn Shumate, a Tacoma-based photographer, my favorite documented portfolio item.

The designer made such a great design, and the great photography is what really makes the website what it is, as it should be for a photographer’s website. I always enjoy viewing the site, and am happy I was part of creating it. I hope you enjoy it as well!


Make your own git hub

I saw a link to this article about using SSH:

I noticed mention of using git locally, and remembered the setup I did twice recently to set up a git server on two separate virtual machines in the cloud recently.

To set it up, you’ll need gitolite, and the instructions are here: . It couldn’t be simpler to install or manage users and repositories. Give it a shot if you need to set up a git server for remote backups or for team collaboration, and let me know if you run into trouble in the comments, and I’ll be glad to help.

Hello, Joomla!

I had the opportunity to work on a Joomla! website yesterday, and I have to admit it was a pleasure. I suppose that is partly because I like to learn, but it was not at all hard to do anything I needed to do, and the IRC channel, #joomla on freenode, and especially a user with nick hple were great help when I needed to consult with an experienced Joomla! developer.

Joomla! has an interesting niche with these “components“, which are some sort of an MVC implementation, so you can fairly quickly build custom apps. I look forward to the opportunity to learn more about it in the future.