Drupal Dump

Drupal Snippets, Hacks and more....

First drush driver behat test

With drush driver for behat you will have some more power, basically drush power to do things. So to make out first drush test, you will need to bring some change in behat.yml file and change some lines.

Behat - log in to a site using only blackbox driver

This just another simple test for behat and mink combo with plain blackbox driver. To log in to a site and do check some behavior you can write this simple test, again no PHP needed for it. You will be logged in and checking what is on people admin page. Add it to your some.feature file and run behat.

Dependency injection and constructors - what really happens

use Drupal\Core\Controller\ControllerBase;
use Drupal\my_module\SomeClass;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response;

class SomeController extends ControllerBase
    private $someProperty;

    public function __construct(SomeClass $someProperty)

Drupal 8 - getting what is what

Getting into drupal 8 from drupal 7 is hard. Especially if you are new to OOP, some articles about what is what will help you on that way. I suggest the following in that order

Drilling data from entities in drupal 8

Still new to this drupal 8 beast and trying to learn how to drill down data from entites. There are this magic getters and setters methods that get you data without need to write them. So

Mixed vagrant enviroments, check where does url load from

I had many vagrant machines and haven't really paid much attention to setting unique hostname, machine name and IP address, which resulted in mixed environments. Meaning I loaded one URL and I got files and database from the other vagrant machine. To debug what was really happening I went into devel/php and found out where is my mind I mean Index file :) to do that I echoed it like this.