·

unit testing

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 ...

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 ...

Unit testing in Magento with PHPUnit

So maybe you’re familiar with unit testing in PHP, maybe not. But when it comes to Magento, there are some thinks to consider when you want to write unit testable code. Now I know, you could use some already existing framework for unit testing in Magento, like EcomDev PHPUnit for example, but if you’re like 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