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\EventDispatcher\EventDispatcherInterface; | |
class BazController | |
{ | |
/** | |
*@Route("/show") | |
*/ | |
public function show(EventDispatcherInterface $eventDispatcher) | |
{ |
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 | |
// Simple hydrator | |
final class Hydrator | |
{ | |
public function hydrate($object, array $data = []) | |
{ | |
foreach ($data as $property => $value) { | |
$method = 'set'.ucfirst($property); | |
if (\method_exists($object, $method)) { | |
$object->{$method}($value); |
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\Entity; | |
class User | |
{ | |
public $login; | |
public $id; | |
public static function create(array $data) |
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\Service; | |
use App\Entity\User; | |
use Symfony\Contracts\HttpClient\HttpClientInterface; | |
class GithubUserRepository | |
{ | |
private $githubClient; |
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
Feature: | |
In order to fetch a User from Github | |
As a developer | |
I want to have a repository that fetch a User from a username | |
Scenario: Fetch a User from Github by a username | |
Given The response have the following body: | |
| id | 42 | | |
| login | ismail1432 | | |
When I fetch a user with username ismail1432 |
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\Tests\Behat; | |
final class GithubContext implements Context | |
{ | |
/** @var GithubUserRepository $githubRepo */ | |
private $githubRepo; | |
/** @var App\Entity\User $user */ | |
private $user; |
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 PostContentController | |
{ | |
/** | |
* @Route("/contents", name="post_content", methods="POST") | |
*/ | |
public function __invoke(NotifierInterface $notifier, Request $request) | |
{ | |
if(null !== $message = (\json_decode($request->getContent(), true)['message'] ?? null)) { |
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 | |
// Kernel.php | |
public function getLogDir(): string | |
{ | |
if (getenv('LAMBDA_TASK_ROOT') !== false) { | |
return '/tmp/log/'; | |
} | |
return parent::getLogDir(); | |
} |
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
service: notifier-linkedin-api | |
provider: | |
name: aws | |
region: eu-west-3 | |
runtime: provided | |
environment: # env vars | |
APP_ENV: prod | |
LINKEDIN_DSN: YOUR_DSN |
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 PostContentControllerTest extends WebTestCase | |
/** | |
* @dataProvider methodProvider | |
*/ | |
public function testANoPostRequestShouldReturnA405(string $method) | |
{ | |
$client = static::createClient(); | |
$client->request($method, '/contents'); |