Magento 2, PHPUnit and magic methods

One can’t mock magic methods in PHPUnit, because of this error. Trying to configure method “getTrackingSent” which cannot be configured because it does not exist, has not been specified, is final, or is static So my workaround until now was to mock __call, like so: This is okay, if one needs only one or maybeContinue reading “Magento 2, PHPUnit and magic methods”

ddev and old packages/PHP extensions

The newest redis PHP extension is unfortunately not compatible with older Shopware versions, showing an error like this: The current ddev version is installing it. And to have a lower version we can just set the package in config.yaml: Unfortunately apt-get which is running in the background of ddev inside the container doesn’t allow toContinue reading “ddev and old packages/PHP extensions”

Testing: Drama numbers

Did you know there are special telephone numbers for tv shows and movies? But we can use them to use them for testing. Don’t use your or other real telephone numbers! Don’t use RANDOM because they might be belong to someone. Bad things might happen, if you do this. The same problem had someone creatingContinue reading “Testing: Drama numbers”

Shopware 5: Empty snippet file

In DatabaseWriter.php line 75:You called write() but provided no data to be written This error occurs, when your snippet file does not contain snippets. In my case my file is living in src/Resources/snippets/plugins/backend/plugin.ini and looked like this: Which doesn’t look empty, but is ? I changed the file to this: But if you don’t needContinue reading “Shopware 5: Empty snippet file”

Simple (Magento|Shopware) plugin release pipeline

We just finished a shipping plugin and were looking for a simple way to deploy it. Because we wanted to allow composer deployments having a git repository somewhere to get it from was already set, but the customer requested a link to a ZIP file. We already had a private and a public repository andContinue reading “Simple (Magento|Shopware) plugin release pipeline”

PHPStan: unspecified value in iterable

I got this error yesterday and it took hours until I figured out the problem. Why you ask? Because the class looked like this: My impression was: why is $record a problem? It has a type! After trying a simpler example at PHPStan’s playground, I found the problem: While writing this blogpost I tried itContinue reading “PHPStan: unspecified value in iterable”

PHPUnit Code Sprint: Issue discussions

assertDirectoryExists and assertDirectoryDoesNotExist failed #5996 Did you know php has a statcache which caches the return values of all kinds of return values from the operating system IO? That means, as long as you stick to the php universe like stat(), lstat(), file_exists(), is_writable(), is_readable(), is_executable(), is_file(), is_dir(), is_link(), filectime(), fileatime(), filemtime(), fileinode(), filegroup(), fileowner(), filesize(), filetype(), and fileperms() everything is fine, but don’t mix it with exec(“rm -rf $yourEscapeDirectory”); More on thisContinue reading “PHPUnit Code Sprint: Issue discussions”

PHPUnit Code Sprint in Autumn

Last week I traveled to Munich to attend PHPCode Sprint. Once again Sebastian Bergmann invited to work together on PHPUnit, close issues, fix bugs and think weird behaviour by tests, PHPUnit itself and PHP through. A big shout out and thank you goes to celebrate company who hosted once gain the hackathon and took careContinue reading “PHPUnit Code Sprint in Autumn”

imapsync on a mac takes too much ram

I’m currently migrating emails for one of our customers from the old hosting company to the new one. To do this we are using imapsync – an awesome tool! TL;DR: Just use the docker box by Gilles… https://hub.docker.com/r/gilleslamiral/imapsync My own journey But currently there is a weird bug on mac, that it might take aContinue reading “imapsync on a mac takes too much ram”