November 28, 2022

The Workshop: Accept testing with Codeception - php[architect] Magazine April 2022

Acceptance testing is a method of verifying our application behaves exactly as expected, often utilizing a web browser. We will write test scenarios that will be acted out by a user interacting with our application such as logging in or performing a specific task. Acceptance tests are slower than unit tests because they rely on a web browser. What we lose in the speed of running acceptance...

learning phparch writing testing


February 25, 2022

The Workshop: Testing with Pest Framework - php[architect] Magazine August 2021

Pest is a PHP testing framework focused on simplicity and brings a powerful expectations API to PHP. Pest is influenced by Jest, a JavaScript testing framework. Pest was created by Nuno Maduro originally via Sponsorware license, and ultimately has been published under the MIT open source license. You can think of Pest ha an alternative to other testing frameworks, such as Codeception, which can...

learning phparch writing php testing


January 10, 2021

The Workshop: Specification BDD with Phpspec - php[architect] Magazine May 2020

phpspec is a package in which we can use behavior driven development, BDD, which comes fromtest driven development, TDD. When applying BDD we’ll write our tests first and then only enough code to pass our tests and then refactor and verify the tests still pass exactly as we would with TDD. This cycle continues and is often referred to as red-green development of writing tests that fail and...

learning phparch writing php testing


August 27, 2020

The Workshop: Describe Your Tests with Kahlan - php[architect] Magazine September 2018

This month we're covering a full featured unit and behavior driven development (BDD) test framework named Kahlan. Kahlan is similar to Rspec (Ruby) and JSpec (Java) using BDD style syntax where you describe the behavior your application should have. We already have tons of PHP testing frameworks readily available in the PHP ecosystem such as PHPUnit, phpspec, Codeception, Behat, and...

learning phparch writing testing php


December 21, 2016

Mocking Swift Mailer -- 3 Steps to better code

A few days ago an issue came across my Jira queue that mentioned odd characters showing up in the subject line of our notification system. We use SwiftMailer library which is a fantastic library for sending mail. The bug report included text similar to: Something was taking our twig template that we use for our email subject and changing the encoding. This is normally done when you want to...

php testing


August 31, 2016

Solidify Fragile Tests

On my first week at the new job I was tasked to fix some tests that were logging data. While the fix was simple enough, by using `Psr\Log\NullLogger as Logger` instead of `Monolog\Logger` in the test, during the process I ran into another test that appeared quite fragile. Fragile test: Our `getFood()` method returns an array of all foods by type. Given that, we would...

php testing


June 10, 2016

php[tek] 2016 in St. Louis was a blast!

This year php[tek] was in St. Louis, an easy four and a half hour drive from Memphis. Since I didn't have to fly to the conference I stocked up on a lot of local Memphis beer to share with my fellow PHP beer connoisseurs. Originally, my awesome wife Kara was going to join me, however, it didn't work out. Because I was giving a day long Laravel training on Monday and wanted some time to settle...

community conferences speaking testing


February 6, 2016

Acceptance and Functional Testing with Codeception -- SunshinePHP 2016

Feedback via Twitter SunshinePHP 2016 was the second time I formally gave my Acceptance & Functional Testing with Codeception talk. I had built the talk from a handful of demo sessions at my local user group: MemphisPHP.org. The first time I gave the talk was at DevSpaceConf in October 2015. I only had two attendees show up to the talk which turned out to be really...

conferences php speaking testing


August 6, 2015

Upload Test Artifacts From Travis-CI to Amazon AWS S3

I've spent a lot of time the past few days trying to get test artifacts to upload to Amazon's AWS S3. I've also spent a lot of time correcting typos from "artifcats" to "artifacts". I'm not sure what an "artifcat" is, but I know what a test artifact is. A test artifact is some file that is created during a test. In my specific case it's the _output folder from my Codeception acceptance tests....

laravel testing aws devops s3 testing


July 29, 2014

TeamCity + Codeception + Laravel = Automated build testing

I'm going to start out by saying this: I'm probably not doing this the "right" way. I've not been able to find anything that really pushes me into the "right" way so I'm documenting what I currently have working in hopes that someone will come along and show me a better way. The project I'm working with is for my day job and covered by some signed documents so I can't really divulge anything...

laravel php testing


June 26, 2014

Unit Testing Laravel 4 w/ Cartalyst Sentry + Mockery

I had a really hard time piecing this together so I thought I'd share it and maybe it would help someone (or me in 2 months when I forget all of this and stumble upon it again). The use case: I have a Controller "BoxesController" that I want to unit test the store() method on. The thing I had to play with some was having the test act as an admin user because I was posting to a route only admins...

php testing laravel