Skip to content

Instantly share code, notes, and snippets.

View Zayon's full-sized avatar

Pablo Godinez Zayon

View GitHub Profile
@Zayon
Zayon / README.md
Last active November 18, 2020 10:09
Xdebug x Docker

Xdebug with Docker

With docker dev image

Dockerfile

FROM production as dev

USER root

Arch installation

Disk Partitionning

fdisk -l or lsblk to identify disks

Determine the main disk where /boot partition will reside. We need two partitions: the one for /boot and the other for LVM group.

Open partitioning tool fdisk /dev/sda

@Zayon
Zayon / bundles.php
Created June 27, 2019 16:25
Enable bundles
<?php
return [
// ...
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], // should already be enabled.
// ..
Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['test' => true],
Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['test' => true],
];
@Zayon
Zayon / FeatureContext.php
Last active June 27, 2019 15:39
SharingContext ArrayAccess demo
<?php
$this->sharingContext['key'] = $value; // set a value
$value = $this->sharingContext['key']; // retrieve value
@Zayon
Zayon / add-products.feature
Created June 27, 2019 15:38
Introducing SharingContext 2
When I send a "POST" request to "/products/" with body:
"""
{
"name": "Super cool drill",
"price": 249.99,
"category": {{ category_tools.id }}
}
"""
@Zayon
Zayon / add-products.feature
Created June 27, 2019 15:37
Introducing SharingContext
Given I store the "id" property of "category_tools" as "category_tools_id"
When I send a "POST" request to "/products/" with body:
"""
{
"name": "Super cool drill",
"price": 249.99,
"category": category_tools_id
}
"""
@Zayon
Zayon / FixtureContext.php
Created June 27, 2019 15:35
fixtures-blogpost protect databases
<?php
/** @var Connection[] $connections */
$connections = $doctrine->getConnections();
foreach ($connections as $connection) {
if ('pdo_sqlite' !== $connection->getDriver()->getName()) {
throw new \RuntimeException('Meaningful message here');
}
}
@Zayon
Zayon / FixtureContext.php
Created June 27, 2019 15:33
fixtures-blog-post schemaTool
<?php
$schemaTool = new SchemaTool($manager);
$schemaTool->dropDatabase();
$schemaTool->createSchema($manager->getMetadataFactory()->getAllMetadata());
@Zayon
Zayon / doctrine.yaml
Created June 27, 2019 15:31
fixtures-blog-post-config/packages/test/doctrine.yaml multiple connections
doctrine:
dbal:
connections:
default_connection: default
# Override each connection
default:
driver: pdo_sqlite
url: 'sqlite:'
path: "%kernel.cache_dir%/test_db.sqlite"
@Zayon
Zayon / doctrine.yaml
Created June 27, 2019 15:30
fixtures-blog-post-config/packages/test/doctrine.yaml
doctrine:
dbal:
driver: pdo_sqlite
url: 'sqlite:'
path: "%kernel.cache_dir%/test_db.sqlite"