On this day: 7 January

2025 · 1 year ago

Listened to 9 tracks

Motörhead, Iron Maiden, blink-182 and 5 more · 32m ·

Tracklist
  1. Limb from Limb · Motörhead
  2. Wrathchild (1998 Remaster) · Iron Maiden
  3. Dumpweed · blink-182
  4. Jesus Frankenstein · Rob Zombie
  5. Along Comes a Woman (2006 Remaster) · Chicago
  6. Overkill · Motörhead
  7. Man of War · Radiohead
  8. I Wouldn't Want to Be Like You · The Alan Parsons Project
  9. Just Don't Give a Fuck · Eminem

Listened to 12 tracks

The Doors, Meat Loaf, Megadeth and 9 more · 52m ·

Tracklist
  1. Soul Kitchen · The Doors
  2. You Took the Words Right Out of My Mouth (Hot Summer Night) · Meat Loaf
  3. These Boots · Megadeth
  4. Leave Out All the Rest · Linkin Park
  5. Her Ghost in the Fog · Cradle of Filth
  6. Savage · Judas Priest
  7. Pressure · Muse
  8. You Can't Always Get What You Want · The Rolling Stones
  9. Shout · Tears for Fears
  10. Call Me Little Sunshine · Ghost
  11. Blood In Heaven · Kataklysm
  12. Amazed · The Offspring

Listened to 2 tracks

Serj Tankian, Queen · 3m ·

Tracklist
  1. Your Mom · Serj Tankian
  2. I Want It All · Queen

Listened to 6 tracks

Motörhead, Tom Petty, The Cardigans and 3 more · 19m ·

Tracklist
  1. Eat the Rich · Motörhead
  2. I Won't Back Down · Tom Petty
  3. My Favourite Game · The Cardigans
  4. Battle Ready · Otep
  5. All Revved Up With No Place to Go · Meat Loaf
  6. The Twisted Nails of Faith · Cradle of Filth

2024 · 2 years ago

Listened to 3 tracks

Ozzy Osbourne, Chas 'n' Dave, Rammstein · 24m ·

Tracklist
  1. Bark at the Moon · Ozzy Osbourne
  2. London Girls · Chas 'n' Dave
  3. DEUTSCHLAND · Rammstein

2023 · 3 years ago

Given, When, Then — how I approach Test-driven development in Laravel

Laravel is an incredible PHP framework and the best starting point for pretty much any web-based application (if writing it in PHP, that is). Along with it’s many amazing features, comes a beautiful framework from which to test what you are building. For the longest time I cowered at the idea of writing automated tests

Laravel is an incredible PHP framework and the best starting point for pretty much any web-based application (if writing it in PHP, that is).

Along with it’s many amazing features, comes a beautiful framework from which to test what you are building.

For the longest time I cowered at the idea of writing automated tests for what I built. It was a way of working that was brought in by a previous workplace of mine and my brain fought against it for ages.

Since that time a few years ago I slowly came to like the idea of testing. Then over the past year or so I have grown to love it.

I have met some people that are incredibly talented developers, but for me made the prospect of automated testing both confusing and intimidating.

That was until I came across Adam Wathan’s excellent Test Driven Laravel course. He made testing immediately approachable and broke it down into three distinct phases (per test): “Given”, “When” and “Then”. Also known as “Arrange”, “Act” and “Assert”. I forget which phrase he used, but either way the idea is like this.

“Given” this environment

The first step is to set up the “world” in which the test should happen.

One example would be if you were building an API that would return PlayStation game data to you. In order to return games, there must be games there to return.

In Laravel we have factories that we can create for quickly creating test entries for our models. Here is an example of a Game model that uses its factory to create a game for us:

$game = Game::factory()->create([
    'title' => 'The Last of Us part 2',
    'developer' => 'Naughty Dog',
]);

“When” this thing I want to test happens

Here you would do the thing that you are testing.

Maybe that is sending some data to an API endpoint in your application. Or perhaps you are testing a single utility class can do a specific action, so you call the method on that class.

Here, let’s continue the idea of return games from an api call. We’ll use the $game variable from the previous example and access its ID to build our GET endpoint:

$response = $this->json('get', '/api/games/' . $game->id,);

Here the $response variable gets the response from the json get call, allowing you to later make assertions against it.

“Then” I should see this particular outcome

In this last step you would make assertions against what has happened. This could be checking if a record exists in a database with specific values, or asserting that an email got sent.

Basically anything you need to make sure happened, or didn’t happen, for you to be sure you are getting your desired functionality.

Let’s finish our game example by asserting that we got json back with the expected data. We do this by calling the appropriate method off of the $response variable from the previous example.

$response->assertJson([
    'title' => 'The Last of Us part 2',
    'developer' => 'Naughty Dog',
]);

The full example test code

$game = Game::factory()->create([
    'title' => 'The Last of Us part 2',
    'developer' => 'Naughty Dog',
]);
$response = $this->json('get', '/api/games/' . $game->id,);
$response->assertJson([
    'title' => 'The Last of Us part 2',
    'developer' => 'Naughty Dog',
]);

Much more to explore

There is so much to automated testing and I’m still relatively new to it all myself.

You can “fake” other things in your application in order to not run live things in tests. For example when testing emails are sent you don’t really want to be actually sending emails when you run your tests. Therefore you would “fake” the functionality of sending the mail.

I hope that this post has been an easy-to-follow intro to how I myself approach testing.

I have found that even as my tests have gotten more complex in certain situations, I still always stick to the same structural idea:

  1. Given this is the world my code lives in.
  2. When I perform this particular action.
  3. Then I should see this specific outcome.

2021 · 5 years ago

Earned 1 trophy in Horizon Zero Dawn

1 bronze ·

Trophies
  • Killed 10 Frostclaws

2020 · 6 years ago

Listened to Psychopath Killer (feat. Eminem) by Slaughterhouse

Listened to Die Alone (feat. Kobe) by Eminem

Listened to 9 tracks

Eminem, Slipknot, Jay-Z and Linkin Park and 4 more · 59m ·

Tracklist
  1. Guts Over Fear (feat. Sia) · Eminem
  2. Detroit Vs. Everybody · Eminem
  3. Points of Authority/99 Problems/One Step Closer · Jay-Z and Linkin Park
  4. Hot Dog · Limp Bizkit
  5. Venice · The Royal Philharmonic Orchestra
  6. Pricks · JME
  7. Living in a French Movie · Hante.
  8. Insert Coin · Slipknot
  9. Nero Forte · Slipknot

Listened to 9 tracks

Meat Loaf, Eminem, Ozzy Osbourne and 4 more · 40m ·

Tracklist
  1. Straight to Hell · Ozzy Osbourne
  2. Paradise by the Dashboard Light · Meat Loaf
  3. Nowhere Fast · Meat Loaf
  4. I Shall Rise · Karen O
  5. Do I Wanna Know? · Arctic Monkeys
  6. Rap God (Explicit) · Eminem
  7. P's And Q's · Kano
  8. Sing for the Moment · Eminem
  9. Detroit Vs. Everybody · Eminem, Royce Da 5'9", Big Sean, Danny Brown, Dej Loaf, Trick Trick

Listened to 30 tracks

Meat Loaf, The Pretty Reckless, Gunship and 16 more · 2h 40m ·

Tracklist
  1. Take Me Down · The Pretty Reckless
  2. Fresh N Clean · D Double E
  3. Jme ft Giggs · Man Don't Care
  4. Bat Out of Hell (PCM Stereo) · Meat Loaf
  5. Wretch 32 & Avelino FITB · BBC Radio 1Xtra
  6. Hide (Instrumental) · morgan willis
  7. Good Girls Go to Heaven (Bad Girls Go Everywhere) · Meat Loaf
  8. Wide Open ft. Beck · The Chemical Brothers
  9. Gravity (GUNSHIP Remix) · Bullet for My Valentine
  10. Regulus · Earmake
  11. I'll Kill You If You Don't Come Back · Meat Loaf
  12. Heaven Knows · The Pretty Reckless
  13. Out of the Frying Pan (And Into the Fire) · Meat Loaf
  14. Woken Furies · Gunship
  15. Make Me Wanna Die · The Pretty Reckless
  16. When You Grow Up, Your Heart Dies · Gunship
  17. Acid Rain · Lorn
  18. Just Tonight · The Pretty Reckless
  19. KILLSHOT · EminemMusic
  20. This Is England · Kano
  21. River of Darkness (feat. Timecop1983) · The Midnight
  22. Lost Boys and Golden Girls · Meat Loaf
  23. Objects In The Rear View Mirror May Appear Closer They Are · Meat Loaf
  24. We Belong To The Night · Ellen Foley
  25. Welcome 2 Detroit · Trick Trick
  26. Eye in the Sky · The Alan Parsons Project
  27. Not Afraid · Eminem
  28. The Real Slim Shady · Eminem
  29. The Gates of Disorder · Gunship
  30. Poison · Alice Cooper

2018 · 8 years ago

Earned 1 trophy in Dead by Daylight 1/3

1 bronze ·

Trophies
  • Happy Holidays

Listened to Guts by Negan

2017 · 9 years ago

Listened to Placebo

3 listens · 12m ·

Tracklist
  1. Running Up That Hill · Placebo
  2. Every You Every Me · Placebo
  3. Pure Morning · Placebo

Listened to Virginia OST by Lyndon Holland

7 listens · 14m ·

Tracklist
  1. Main Titles · Lyndon Holland
  2. Inauguration · Lyndon Holland
  3. Taxi Ride · Lyndon Holland
  4. Anne's Assignment · Lyndon Holland
  5. Welcome to Kingdom · Lyndon Holland
  6. Lucas Fairfax · Lyndon Holland
  7. In Dreams · Lyndon Holland

2016 · 10 years ago

2015 · 11 years ago

Earned 1 trophy in Far Cry® 4

1 bronze ·

Trophies
  • Make It Rain

2014 · 12 years ago

2013 · 13 years ago