Blog (3 of 14)
-
[object Object]
When people start (unit-)testing their code one of the worst problems to tackle are static calls. How can we refactor static calls out of an existing application without breaking the code and while producing new features? How can we get rid of this big test impediment?
Tuesday 10 January 2017Read more ➞ -
Using Traits With PHPUnit
As we already wrote that "Code Reuse By Inheritance" has lots of problems and we consider it a code smell. You should always aim to use Dependency Injection, most likely Constructor Injection. But with test cases in PHPUnit we cannot do this because we have no control about how and when our test cases are created. There are a similar problem in other frameworks, like we discussed in "Object Lifecycle Control". We also blogged about traits as a Code Smell, but let me show and explain why they might be fine to use in your test cases.
Tuesday 29 November 2016Read more ➞ -
Database Fixture Setup in PHPUnit
We already discussed when and how to reset a database between tests. But on top of that you often need some basic or more complex data to run the tests against. We discuss different variants and their respective trade-offs in this post…
Tuesday 15 November 2016Read more ➞ -
Database Tests With PHPUnit
Most of us do not use PHPUnit solely for Unit Tests but we also write Integration or Acceptance Tests with PHPUnit. One very common question then is how to interact with the database correctly in those tests. Let me show you the different options and their trade offs…
Tuesday 4 October 2016Read more ➞ -
Introduction To Page Objects
A while ago we wrote about writing acceptance tests (end-to-end tests) with Mink and PHPUnit. While this is a great set of tools for various applications such tests tend be susceptible to changes in the frontend. And the way they break is often hard to debug, too. Today I will introduce you to Page Objects which can solve some of these problems.
Tuesday 6 September 2016Read more ➞ -
Scaling Constraints of Languages
Micro-Services or any set of small services are common again right now. While it is pretty obvious for most that selecting the right database is important the same is true for selecting the right language (virtual machine) for the job. There are different types of services or server applications where different types of virtual machines make more or less sense. What are the criteria we should base such a decision on and which language should we choose when?
Tuesday 2 August 2016Read more ➞ -
Outside-In Testing and the Adapter and Facade Patterns
Outside-In Testing benefits a lot from the facade and adapter patterns, which will separate your code from third-party libraries and simplify the APIs of your system.
Tuesday 5 July 2016Read more ➞ -
How To Synchronize a Database With ElasticSearch?
Since search engines like Apache Solr and ElasticSearch are easy to use and setup more and more applications are using them to index their content and make it searchable by the user. After all the underlying Lucene index engine provides far more powerful features then a plain MySQL full text search or similar solutions. With Apache Solr and ElasticSearch you can enhance the performance and the functionality of your website. What we often stumble across, though, is the naiive approach of synchronizing both data storages which tends to fail in multiple ways. Let me show how you can fix this.
Tuesday 14 June 2016Read more ➞ -
How to Refactor Without Breaking Things
Refactoring means to change the structure of your code without changing its behavior. Refactoring is an essential part of everyday programming and should become knee-jerk for your whole development team. It is very helpful to cleanup feature spikes, revise earlier decisions and keep a maintainable code base in the long run. In a perfect project world - with extensive automated tests of various types - this is just a matter of getting used to. But there are only very few such projects, so getting into proper refactoring is much harder. This article will show you important tips to master this challenge with your team.
Wednesday 1 June 2016Read more ➞ -
When to Abstract?
One of the most difficult challenges in a developers life is finding the "right" abstraction, or at least the best one given the current circumstances. The core problem is that abstraction is a bet on the future development of the software and we know that future is volatile. The circumstances will change, so will the view on the best abstraction change.
Tuesday 17 May 2016Read more ➞ -
[object Object]
When doing code reviews together with our customers we see a pattern regularly which I consider problematic in multiple regards – the usage of null as a valid property or return value. We can do better than this.
Tuesday 3 May 2016Read more ➞ -
Common Bottlenecks in Performance Tests
Most developers by now internalized that we should not invest time in optimizations before we know what happens exactly. This is true for optimizations in your PHP code but also for optimizations regarding your infrastructure. We should measure before we try to optimize and waste time. How can this be done?
Tuesday 19 April 2016Read more ➞
Subscribe to updates
There are multiple ways to stay updated with new posts on my blog: