·

Search results

Your search for “phpunit” yielded the following results:

How to enable PHPUnit code completion in PhpStorm

So you’ve got PhpStorm and you’re writing your tests with PHPUnit. But how do you get the code completion to work? Well, the solution is very simple:read further ...

PHPUnit setup and teardown for tables

When you’re unit testing your code with PHPUnit, chances are that at some point you have to test some methods that involve manipulation on the database. Of course, you’ve written some test that validate the data in the database afterwards, and you might already have written a bootstrap that prepares the database for each testrun, but what 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 ...

Regexes for quickly mocking stuff

This is a small collection of regular expressions to find pieces of code and replace them with PHPUnit mocks. It’s useful for copy/pasting existing pieces of code (a constructor signature for example) and transforming them into usefull code for mocking in PHPUnit, without having to type everything out. Disclaimer: some small code formatting might be read further ...

Quickly run scripts in the shell in Magento 2

Magento 2 has a great functionality for running scripts in the command line, but sometimes you just want to quickly check something without creating a new CLI command or creating a unit test. Wouldn’t it be great if you could just write a PHP script and write some simple code in it, just to speed read further ...

Unit Test your custom module in Magento 2

Magento 2 comes with a great set of unit tests out-of-the-box. You can add these tests to your module as described by Ash Smith in this article, but that means you need to run your unit test with the –filter  attribute like so: This is great of course, but it still means the entire test read further ...

How to write unit tests for your websites’ JavaScript with Mocha

As some of you might know, I’ve already written a lot of posts about unit testing in PHP. But what about your JavaScript? That might require testing too. Especially when it comes to critical functions that involve complex operations. One road you could take to do this is use a headless browser and a testing read further ...

How to install PHP Mess Detector for PhpStorm on OSX

Recently I’ve been upgrading the way I write code. I’ve been programming for a while now, but there’s always room for improvement. Lucky for us developers, there are numerous tools for us we can use to aid us in our development. Things like unit testing and coding standards are great of course. But there’s also read further ...

Generating dummy products for unit tests in Magento

I already wrote a number of posts about unit testing in Magento, but as with everything in Magento, some things are tricky to do, especially when it comes to unit tests. So the other day I wrote a module that needed to do certain actions according to the value of some product attributes. Needless to read further ...

1 2 3