There are 56 articles tagged as "php"

Dealing with bit rot in a side project

on December 14, 2020. in Programming, Development. A 3 minute read.

As I wrote earlier, I’m “reviving” a personal project that I didn’t touch for a year. The development environment is dockerized, so the first task I need to do is to run the application it see what happens. As it turns out not much happens, as a mild case of “bit rot” set in.

A refactoring example

on January 13, 2020. in Programming, Development. A 5 minute read.

I’m working on a small side project to gather stats about my blog. Posts published, words written, number of code examples. Good for practicing TDD. I want to share how I made one part of it better.

Continue reading A refactoring example...

PhpStorm previous version settings not imported

on March 29, 2019. in Software, Development. A 1 minute read.

PhpStorm 2019.1 was released yesterday. During the first run after the upgrade PhpStorm usually asks from what previous version would I like to import the settings from, but this time it didn’t ask that. It rather imported some of my old settings, but not the latest ones I had for 2018.3.

Accessing Symfony private services in Behat

on February 01, 2019. in Programming, Development. A 2 minute read.

Since Symfony 3.4 the services in the service container are private by default. While this decision made us write better production code by making us use Dependency Injection more and rely on the service container less, using these services in a test environment proved to be a challenge.

Testing Symfony commands with Behat

on January 18, 2019. in Programming, Development. A 5 minute read.

The other day I was creating a Symfony command that will be periodically executed by a cronjob. I decided to write a Behat test for it, to see what a test like that would look like. Plus, just because it is executed by the system from a command line, doesn’t mean we can skimp on the business requirements.

Easier Mocking With Mockery in php[architect]

on April 20, 2018. in Blablabla. A 1 minute read.

In early February I got an email from Oscar would I be willing to write an article for php[architect], based on my “Easier mocking with Mockery” talk. It took me maybe 2 seconds to think about it and say “Yes!”. The first part of the article was published in the April’s edition of the magazine. Lots of useful content in there, not just my article!

This past weekend I was playing around on some pet projects and wanted to get up and running quickly. My initial reaction was to reach for a Vagrant box provisioned with Ansible. After all, that’s what I’ve been using for a really long time now.

Mockery partial mocks

on January 28, 2018. in Programming, Development. A 3 minute read.

In dealing with legacy code I often come across some class that extends a big base abstract class, and the methods of that class call methods on that big base abstract class that do an awful lot of things. I myself have written such classes and methods in the past. Live and learn.

Continue reading Mockery partial mocks...

Mockery return values based on arguments

on December 12, 2017. in Programming, Software, Development. A 3 minute read.

Sometimes when working with Mockery mock objects, we want to tell a mocked method to return different values for different arguments. It is a rare occasion when I need this feature, but every time I need it, I’m happy it’s there.

Reacting to promises

on November 29, 2017. in Programming, Development, Software. A 5 minute read.

I was working on something that includes the usage of ReactPHP promises. Given that I haven’t had the chance to take a closer look at it yet, I decided that this is the right time for it.

Continue reading Reacting to promises...