Drupal Dump

Drupal Snippets, Hacks and more....

429 posts since 2011

Docker/Vagrant on Mac speed tests

So file synching is a pain int he ass on MacOS so I made some tests with "wrk" tool to see what is what and how much request per second can each config handle. I started with install.php on D8 site as it is more about file and less about database and caching. Tool was used with this config (30s of requests) 

Running A PHPUnit Test

There are different ways in which we can run our PHPUnit tests. We can either run a full unit test, a test suite or one specific test as shown in following commands:

To run all the tests available from the custom modules directory:

Faster DrupalVM provisioning

For complex application, provisioning your box with the initial “vagrant up” command can take a long time. Fortunately, it’s not necessary to do this for every member of your team, on every computer that will be used for development. You can use the following command to create a filename.box file, which is the already provisioned box.

Drupal commerce how to add Payment programmatically

Payment is specific entity in drupal commerce, usually it will be added by payment gateway module through checkout flow, but if you need to make some custom payments programmatically then you can do it in a following way, first you would need to get payment gateway object, so you can fetch proper info, after that you need to fill in paraparameters for new payment creation, depending on how you

Drupal commerce how to make shipments(shipping) programmatically

Drupal commerce shipping module is complex, there are few moving parts that you need to consider when making custom changes to it. First there are shipment types which are associated with order type, this is usually done through UI, unless you also add order type programmatically.