Skip to content

Instantly share code, notes, and snippets.

View gquemener's full-sized avatar
🏄‍♂️

Gildas Quéméner gquemener

🏄‍♂️
  • Palo-IT
  • Saint-Gilles-Croix-de-Vie, France
  • 06:27 (UTC +01:00)
  • X @GildasQ
View GitHub Profile
@gquemener
gquemener / dev.pp
Last active December 13, 2015 23:59
Puppet manifest to install my linux dev environment
user { "gildas":
ensure => "present",
managehome => true,
before => Exec["install_dotfiles"]
}
package { "git":
ensure => installed,
before => Exec["install_dotfiles"]
}
@gquemener
gquemener / gist:5722064
Last active December 18, 2015 03:59
Which one is the clearest?
<?php
//PHPUnit
public function testApply() {
$mock = $this->getMock('My\Foo\Class', array('apply'));
$mock->expects($this->any())
->method('apply')
->with('foo')
->will($this->returnValue('bar'));
@gquemener
gquemener / gist:5934507
Created July 5, 2013 13:26
Mocking any object methods with mockery
<?php
/**
* @param stdClass $object
*/
function it_should_do_stuff($object)
{
$object->getBar()->willReturn('foo');
$stuffedObject = $this->doStuff($object);
<?php
function formatAsString($data)
{
if (is_array($data)) {
$result = array();
foreach ($data as $key => $value) {
$result[] = sprintf('%s => %s', formatAsString($key), formatAsString($value));
}
@gquemener
gquemener / junit.valid.xml
Last active January 4, 2016 06:29
Bug with PhpSpec JUnit Formatter
<?xml version="1.0"?>
<testsuites>
<testsuite name="Pim\Bundle\CatalogBundle\Manager\LocaleManager" id="/home/gildas/projects/pim/spec/Pim/Bundle/CatalogBundle/Manager/LocaleManagerSpec.php" tests="12" failures="0" errors="0" time="0.11581373214722">
<testcase name="provides locale from the request if it has been set" classname="Pim\Bundle\CatalogBundle\Manager\LocaleManager" time="0.031787157058716"/>
</testsuite>
</testsuites>
@gquemener
gquemener / gist:10383889
Created April 10, 2014 13:45
Composer require bug
➜ pim git:(master) ✗ composer.phar --version
Composer version a023c7929aba08861bea56e9cb371b2d31a1eb5b 2014-04-10 13:28:36
➜ pim git:(master) ✗ composer.phar require foo/foo --no-update -v
Please provide a version constraint for the foo/foo requirement: dev-master
[ErrorException]
Undefined variable: childrenClean
@gquemener
gquemener / FooSpec.php
Created May 5, 2014 15:00
Consecutive calls mocking /w phpspec
<?php
/**
* What I want to achieve
*/
class FooSpec
{
function it_does_stuff($collab)
{
$collab->doCollabStuf()->willReturn('foo'); // Returns foo the first time
<?php
/**
* @ORM/Entity
*/
class Product
{
/**
* @OneToMany(targetEntity="Price", mappedBy="product", cascade={"refresh"})
*/
@gquemener
gquemener / .gitignore
Last active September 7, 2022 07:11
SuperMemo 2 PHP Implementation
composer.lock
/vendor
const FILTER_BY_NAME = 'FILTER_BY_NAME';
filterByName(name) {
return (dispatch, getState, ga) => {
ga('send', 'event', 'Catalog', 'filter by name', name);
return { type: FILTER_BY_NAME, name };
}
}
export default {