Skip to content

Instantly share code, notes, and snippets.

@mageekguy
mageekguy / gist:3136340
Created July 18, 2012 13:52
Problem with behat 2.4 + SF 2.1 + goutte
fch@gimli:/var/www/webloc3.lan(sf21)
622> php ./bin/behat src/Webloc/WeblocAuthBundle/Features/login.feature
.string(70) "Values of cookie jar in Symfony\\Component\\BrowserKit\\Client::request: "
array(0) {
}
string(101) "REQUEST: GET /app_test.php/ HTTP/1.1\r\nHost: webloc3.lan\r\nHttps: \r\nUser-Agent: Symfony2 BrowserKit\r\n\r\n"
string(921) "RESPONSE: Date: Wed, 18 Jul 2012 13:51:24 GMT\nServer: Apache/2.2.20 (Ubuntu)\nX-Powered-By: PHP/5.3.14-1~dotdeb.0\nlocation: http://webloc3.lan/app_test.php/login\ncache-control: no-cache, max-age=2592000\nx-debug-token: 5006bf5cae470\nSet-Cookie: MOCKSESSID=d8a0b700978a40e3e38771ae2fbe4eb94cd91d64; expires=Wed, 18-Jul-2012 14:51:24 GMT; path=/\nExpires: Fri, 17 Aug 2012 13:51:24 GMT\nVary: Accept-Encoding\nContent-Encoding: gzip\nConnection: close\nContent-Type: text/html; charset=UTF-8\n\n<!DOCTYPE html>"...
string(70) "Values of cookie jar in Symfony\\Component\\BrowserKit\\Client::request: "
array(1) {
'MOCKSESSID' =>
<?php
class phpClass {};
class_alias('phpClass', 'class');
$className = 'class';
$class = new $className();
<?php
$request = new atoum\fpm\request();
$request->request_method = 'GET';
$request->script_filename = __DIR__ . DIRECTORY_SEPARATOR . 'post.php';
$request->query_string = 'query=1234';
var_dump($request(new atoum\fpm\client('127.0.0.1', '9000')));
<?php
$request = new atoum\fpm\request();
$request->request_method = 'POST';
$request->script_filename = __DIR__ . DIRECTORY_SEPARATOR . 'post.php';
$request->content_type = 'application/x-www-form-urlencoded';
$request->stdin = 'query=1234';
var_dump($request(new atoum\fpm\client('127.0.0.1', '9000')));
@mageekguy
mageekguy / gist:3305279
Created August 9, 2012 15:43
Fichier de configuration de atoum pour utiliser le moteur FastCGI
<?php
/*
Sample fcgi configuration file.
Do "php path/to/test/file -c path/to/this/file" or "php path/to/atoum/scripts/runner.php -c path/to/this/file -f path/to/test/file" to use it.
*/
use
mageekguy\atoum,
mageekguy\atoum\test\engines\fcgi
fch@Tornade:~/Atoum/repository(master *$%)
21> php scripts/runner.php --test-all
> PHP path: /usr/local/bin/php
> PHP version:
=> PHP 5.4.5 (cli) (built: Jul 24 2012 21:39:33)
=> Copyright (c) 1997-2012 The PHP Group
=> Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
> mageekguy\atoum\tests\units\adapter...
[SS__________________________________________________________][2/2]
=> Test duration: 0.01 second.
public function isNearlyEqualTo($value, $epsilon = null, $failMessage = null)
{
static::check($value, __METHOD__);
// see http://www.floating-point-gui.de/errors/comparison/ for more informations
$originalValue = abs($this->valueIsSet()->value);
$value = abs($value);
$diff = abs($originalValue - $value);
if ($epsilon === null) {
@mageekguy
mageekguy / gist:3551810
Created August 31, 2012 11:47
Atoum, mock and __call are in a boat !
<?php
/*
And it's AWESOME !
Imagine that you have a class like this :
*/
namespace mageekguy\atoum;
@mageekguy
mageekguy / gist:3712789
Created September 13, 2012 08:05
Sur le canal IRC ##atoum sur Freenode de bon matin…
Guile: salut à tous
jubianchi[work]: salut Guile
marmotz: salut Guile
marmotz: (ça fait un peu réunion des alcoolique anonyme, là...)
marmotz: Bonjour, je m'appelle Renaud et ça fait 6 mois que je n'ai pas touché une ligne de PHPUnit.
Guile: Bonjouuuuuuur Renauuuuuud…
marmotz: il y a quelques jours, j'ai failli replonger
marmotz: mais j'ai résisté
marmotz: j'ai réécris intégralement tous les tests unitaires avec atoum
marmotz: et je me sens mieux
@mageekguy
mageekguy / gist:3944632
Created October 24, 2012 07:49
Big file iterator
<?php
class bigFileFilterIterator extends recursiveFilterIterator
{
protected $minSize = 0;
public function __construct(recursiveIterator $iterator, $minSize = 10000)
{
parent::__construct($iterator);