Skip to content

Instantly share code, notes, and snippets.

View SebSept's full-sized avatar
💭
Learning...

Sébastien Monterisi SebSept

💭
Learning...
View GitHub Profile
$url_str = "array('site/page', 'view' => 'contact')";
$url_array = $this->evaluateExpression($url_str);
echo CHtml::link('Mon lien', $url_array);
@SebSept
SebSept / login.feature
Created November 4, 2013 17:52
just a test with behat / mink / selenium
# features/login.feature
Feature: login
Vérification que user peut se logger
Scenario: accueil du site -> click sur s'identifier -> saisir données et vérifier que loggé
Given I am on homepage
Then I should see "Bienvenue, identifiez-vous" in the "p#header_user_info" element
When I follow "identifiez-vous"
Then I should see "Déjà enregistré ?"
<!DOCTYPE html>
<html>
<head>
<title>TODO supply a title</title>
</head>
<body>
<div id="newsletter_block">
<form>
<input type="text" value="ma val" name="email" />
<input type="submit" />
<?php
$I = new WebGuy($scenario);
$I->wantTo('check bloc promotions');
$I->amOnPage('/test.html');
$I->see('TODO supply a title');
$input_val = $I->grabValueFrom('input[name=email]'); //
\PHPUnit_Framework_Assert::assertEquals('votre e-mail', $input_val );
$I->dontSeeError();
@SebSept
SebSept / tmp.php
Last active August 29, 2015 14:02
Script fourni à git bisect pour trouver le commit fautif.
#!/bin/env php
<?php
// suppression du cache (pas necessaire)
`sudo rm -Rf /home/seb/dev/htdocs/perso/lblog/app/storage/cache/*`;
// premier appel de la page, pour créer le cache, il faut donc s'assurer que le cache 'file' est bien activé avant.
`wget http://localhost/perso/lblog/public/aut-ex-accusantium-quo-tenetur-harum -q -O /tmp/o`;
// second appel de la page, contenu stocké dans /tmp/o et header stocké dans /tmp/h, au cas ou la page ne serait pas présente dans la base a se moment (ou non public)
`wget http://localhost/perso/lblog/public/aut-ex-accusantium-quo-tenetur-harum -O /tmp/o -o /tmp/h`;
$headers = file_get_contents('/tmp/h');
@SebSept
SebSept / gist:25bc5523f5611020767a
Created January 23, 2015 14:46
blog_debug_mails
<?php
public function testEnvoi_destinataires_du_mail()
{
$this->assertUsePhpMail();
$this->assertTrue($this->module->envoiMail());
$mail = json_decode(file_get_contents('/tmp/lastmail'));
$destinataires = $mail->bcc;
@SebSept
SebSept / gitignore.php
Created October 19, 2015 18:54
tiny php script to add files to .gitignore file
#!/bin/env php
<?php
/**
* add files to .gitignore.
* Put this file in your bin dir (/home/<username>/bin/), make it executable (chmod +x /home/<username>/bin/gitingore.php). Done.
**/
// remove script name
array_shift($argv);
// arguments are file name
$files = $argv;
@SebSept
SebSept / DbPDO.php
Created October 20, 2015 19:26
Prestashop DbPdo class override | /override/classes/db/DbPDO.php
<?php
/**
* Class DbPDOCore
*
* /override/classes/db/DbPDO.php
* @since 1.5.0.1
*/
class DbPDO extends DbPDOCore
{
@SebSept
SebSept / mikey179_vfsStream_example.php
Created December 11, 2015 12:01
Virtual in memory php filesystem | https://github.com/mikey179/vfsStream example.
<?php
/**
* This is just a simple example how to use mikey179/vfsStream - https://github.com/mikey179/vfsStream
*
* Don't be fooled by the documentation.
* This lib is great but the documentation can let you thinks it's complicated or not 'natural' filesystem usage.
* This lib register a php stream so you can (almost) use filesystem function in a regular fashion.
*
* @see http://php.net/manual/en/book.stream.php
* @see http://php.net/manual/en/stream.streamwrapper.example-1.php
<?php
/**
* check sendtoafriend module vulnerability
*
* run it in terminal
*
* @link https://blog.seb7.fr/a/faille-sécurité-prestashop-module-envoyer-a-un-ami
* @author seb7.fr
*/