·

Search results

Your search for “phpunit” yielded the following results:

How I run unit tests in Vagrant, in Jenkins

As some of you might know, I use Vagrant to setup my local environment, and Jenkins for my continuous integration. One major part of this setup is to automatically run tests after Jenkins is done building – and before it deploys the website to the production server. In this article I am going to share with read further ...

Best practices when it comes to importing CSV files

I often have situations where I – as a web developer – have to link together two different applications. In many cases, this link is created by simply exchanging CSV-documents with an third party. Now when it comes to importing and exporting in PHP (or any other language for that matter) it’s important that you have read further ...

Unit testing frontend events in Magento

When you are creating unit tests for Magento and you want to test the events you’re dispatching you can use the following code to manually trigger your events: However, you’ll find that when you’re running this test, your event doesn’t get fired at all! That’s because this particular event (and many others) are fired read further ...

Magento unit testing with specific customers

Sometimes you have the situation where you have to write unit tests for Magento that involves Magento customers. If – for example – you have some business logic that depends on certain customer- (or address-) attributes, you want to make sure your code works as expected before you’re deploying it to a live server. Unit testing read further ...

Unit testing Magento with the database

This year I want to dive more into unit testing in PHP. Writing good, test-driven code is important for the stability and guarantee of your project, but it also helps you – as a developer – sleep a little better at night. You might have seen earlier posts regarding unit testing in PHP in the past, read further ...

Change Magento configuration on the fly

Sometimes you have a situation where you need to change the configuration of Magento on the fly. Just for your single request, without saving it. This can be easily done with the Magento configuration Model: If you want to change a configuration value on the fly on store-level, you can do this as follows: read further ...

How to keep the fun in webdevelopment

As a programmer, your work can become a bit… boring sometimes. If you think you’ve lost al fun in your job as a webdeveloper, than read this post on how to turn that frown upside down.read further ...

Unit test with a test database

When writing unit tests, you sometimes have to test if function did proper operations to the database. Simple CRUD-operations for example: you want to test if your code is affecting the database like you intended. Or for more complex situations, like imports or mass mutations you want to be able to test everything thoroughly. Now, read further ...

How to write unit testable code

We all know the importance of unit testing. But to write unit testable code requires a different kind of thinking. Take this method for example: it’s a simple method that executes a SQL query: Now you could imagine that to test this code it requires setting up some actions to do before running your test read further ...

1 2 3