Skip to content

Instantly share code, notes, and snippets.

View sileence's full-sized avatar

Duilio Palacios sileence

View GitHub Profile
@sileence
sileence / CreatePageTest.php
Created August 22, 2019 09:01
Example of validation test with Laravel using custom assertion to avoid code repetition
<?php
//......
class CreatePageTest extends TestCase
//.....
/** @test */
function meta_description_is_required()
@sileence
sileence / DetectRepeatedQueries.php
Last active October 26, 2023 06:54
Trait to detect repeated queries (i.e. N+1 problem) inside unit tests
<?php
namespace Tests;
use Illuminate\Support\Facades\DB;
trait DetectRepeatedQueries
{
public function enableQueryLog()
{
@sileence
sileence / Demo.php
Last active September 7, 2018 19:27
Little trick to test and inspect the body of the mailable classes
<?php
//Usage:
//$token = factory(etc...);
$this->open(new TokenMail($token))
->seeLink($token->url, $token->url);