- Facility to write and execute E2E tests,
- Facility to write and execute Integration (e.g. repository) tests.
- Facility to control DB state effectively (e.g. fixtures for dev setup + tests)
- Ability to test emails
- Test reports (e.g. monitor test results over time)
- Performance / load tests (e.g. Jmeter, Gatling, PHPBench)
- Smoke tests (e.g. CMS pages) on local / int / live
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
OUTDIR=$HOME"/blog/static/images/spain2024" | |
mkdir -p $OUTDIR | |
echo "" > markdown | |
# get the "last synced" timestamp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class OrganisationContext implements Context | |
{ | |
/** | |
* Fixture container is similar to a service container, but for class instances. | |
*/ | |
public function __construct(private FixtureContainer $fixture) | |
{ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Command; | |
use RuntimeException; | |
use Symfony\Component\Console\Command\Command; | |
use Symfony\Component\Console\Input\InputArgument; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace PhpBench\Expression\ColorMap\Util; | |
use RuntimeException; | |
final class Color | |
{ | |
/** | |
* @var int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\HttpFoundation\Request; | |
use Drupal\Core\DrupalKernel; | |
$autoload = require __DIR__ . '/vendor/autoload.php'; | |
$cwd = getcwd(); | |
chdir('docroot'); | |
$drupalKernel = DrupalKernel::createFromRequest( |
$ composer require phpstan/phpstan
Drupal dynamically adds to the class autoloader at runtime, so it is necessary to bootstrap Drupal in order that it is fully populated. Note that this may require that the database be accessible (i.e. may be problematic when working with Docker). This is why we use a custom autoload file below.
$ ./bin/phpstan analyse --level=7 -c phpstan.neon docroot/modules/custom
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Drupal\Core\DrupalKernel; | |
use Symfony\Component\HttpFoundation\Request; | |
use Drupal\Core\Database\Database; | |
$autoload = require __DIR__ . '/autoload.php'; | |
$kernel = new DrupalKernel('prod', $autoload); | |
$kernel->setSitePath(__DIR__); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Run a command in the app container as the www-data user | |
ARGS="$@" | |
docker exec --user=www-data --tty=true `docker-compose ps -q app` $ARGS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# locate CharName.pm | |
egrep -i "^[0-9a-f]{4,} .*$*" /usr/lib/x86_64-linux-gnu/perl5/5.24/Unicode/CharName.pm | while read h d; do /usr/bin/printf "\U$(printf "%08x" 0x$h)\tU+%s\t%s\n" $h "$d"; done |
NewerOlder