Skip to content

Instantly share code, notes, and snippets.

View pablofmorales's full-sized avatar
🙈
Somewhere in the world

Pablo Morales pablofmorales

🙈
Somewhere in the world
View GitHub Profile
<?php
namespace Providers;
use Silex\Application;
use Silex\ServiceProviderInterface;
use Symfony\Component\Yaml\Yaml;
class ConfigServiceProvider implements ServiceProviderInterface
{
@pablofmorales
pablofmorales / gist:4680373
Last active December 11, 2015 23:58
When I try to mock a class which use QueryBuilder :(
<?php
class TestTest extends \PHPUnit_Framework_TestCase
{
public function test_someAwfulTest()
{
$expected = array(array('name' => 'buenos aires'));
$connectionMock = $this->getMockBuilder('Doctrine\DBAL\Connection')
->disableOriginalConstructor()
->getMock();
@pablofmorales
pablofmorales / gist:5111270
Created March 7, 2013 20:00
Watir example
require 'rspec'
require 'watir-webdriver'
browser = Watir::Browser.new
RSpec.configure do |config|
config.before(:each) { @browser = browser }
config.after(:suite) { browser.close unless browser.nil? }
end
require 'rspec'
require 'watir-webdriver'
browser = Watir::Browser.new
RSpec.configure do |config|
config.before(:each) { @browser = browser }
config.after(:suite) { browser.close unless browser.nil? }
end
@pablofmorales
pablofmorales / smoke.sh
Last active December 15, 2015 10:49
Smoke trigger
#!/bin/bash
RESULT=$(phpunit tests/Smoke);
if [[ $RESULT =~ FAILURES ]]; then
echo "THE TESTS FAILS"
echo $RESULT
exit 1;
fi
@pablofmorales
pablofmorales / CountryService.php
Created April 10, 2013 18:38
Ejemplo de uso de Validator
<?php
namespace Services;
use Models\CountryMapper;
use Billing\Services\ServiceValidator;
use Symfony\Component\Validator\Constraints\NotNull;
class Country
{
@pablofmorales
pablofmorales / gist:5503494
Created May 2, 2013 16:39
Smoke.sh para correr todo los tests de smoke, y comprobar rapidamente si debemos seguir con el deploy o tirar todo para atras.
#!/bin/bash
RESULT=$(phpunit tests/Smoke);
if [[ $RESULT =~ FAILURES ]]; then
echo "TEST WAS FAILED"
echo $RESULT
exit 1;
fi