Skip to content

Instantly share code, notes, and snippets.

@isidromerayo
isidromerayo / gist:b9599035d6a827509dd4
Created November 20, 2014 13:07
Test symfony installer
isidromerayo@hurhinfext16:~$ curl -LsS http://symfony.com/installer > symfony.phar
isidromerayo@hurhinfext16:~$ mv symfony.phar bin/
isidromerayo@hurhinfext16:~$ chmod a+x bin/symfony.phar
isidromerayo@hurhinfext16:~$ symfony.phar
isidromerayo@hurhinfext16:~$ cd projects/PHP/
isidromerayo@hurhinfext16:~/projects/PHP$ symfony.phar new my_project
Downloading Symfony...
4,74 MB/4,74 MB ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100%
~/projects/PHP$ php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
@isidromerayo
isidromerayo / gist:4794b88f803a2ec82ced
Created November 24, 2014 18:19
symfony installer - Ubuntu 14.04
isidromerayo@nikki:~/projects/Symfony2$ symfony.phar new my_project_installer_2.5 2.5.6
Downloading Symfony...
4.74 MB/4.74 MB ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100%%
Preparing project...
@isidromerayo
isidromerayo / gist:d9602ee59b2204fb3d3d
Created January 2, 2015 12:51
Reconnect linkedin
Notice: Undefined index: refrom in /var/www/deploy/portal/releases/20141216145713/login/linkedin/connect.php on line 15 Notice: Undefined index: refrom in /var/www/deploy/portal/releases/20141216145713/login/linkedin/connect.php on line 17 Notice: Undefined index: refrom in /var/www/deploy/portal/releases/20141216145713/login/linkedin/connect.php on line 19 Notice: Undefined index: oauth in /var/www/deploy/portal/releases/20141216145713/login/linkedin/connect.php on line 59 Fatal error: Uncaught exception 'LinkedInException' with message 'LinkedIn->retrieveTokenAccess(): bad data passed, string type is required for $token, $secret and $verifier.' in /var/www/deploy/portal/releases/20141216145713/includes/linkedin.php:868 Stack trace: #0 /var/www/deploy/portal/releases/20141216145713/login/linkedin/connect.php(59): LinkedIn->retrieveTokenAccess('77--4b7816d6-c0...', NULL, '57379') #1 {main} thrown in /var/www/deploy/portal/releases/20141216145713/includes/linkedin.php on line 868
@isidromerayo
isidromerayo / about.md
Created August 17, 2011 12:17 — forked from kinisoftware/about.md
Programming Achievements: How to Level Up as a Developer
@isidromerayo
isidromerayo / PointOfSale2Test.java
Created January 24, 2012 18:06
Second test with Mockito - Point Of Sale - Hola TDD
@Test
public void onBarcode_search_catalog() throws Exception {
Catalog catalog = mock(Catalog.class);
Screen screen = mock(Screen.class);
PointOfSale pointOfSale = new PointOfSale(catalog, screen);
pointOfSale.onBarcode("123");
verify(catalog).search("123");
}
@isidromerayo
isidromerayo / PointOfSaleTest.java
Created January 24, 2012 17:37
First test with Mockito - Point Of Sale - Hola TDD
@Test
public void onBarcode_search_catalog() throws Exception {
Catalog catalog = mock(Catalog.class);
PointOfSale pointOfSale = new PointOfSale(catalog);
pointOfSale.onBarcode("123");
verify(catalog).search("123");
}
@isidromerayo
isidromerayo / ExceptionsTest.php
Created February 6, 2012 18:25
PHPUnit Mock examples
<?php
/**
* @expectedException RuntimeException
*/
public function testThrowExceptionStub()
{
$stub = $this->getMock('SomeClass');
$stub->expects($this->any())
@isidromerayo
isidromerayo / TemperatureTest_Mockery.php
Created February 6, 2012 18:13
Example temperature webservice
<?php
/**
* @test
*/
public function getsAverageTemperatureFromThreeServiceReadings() {
$service = m::mock('Service');
$service->shouldReceive('readTemp')->times(3)->andReturn(10, 12, 14);
$temperature = new Temperature($service);
$this->assertEquals(12, $temperature->average());
@isidromerayo
isidromerayo / ExceptionsTest.php
Created February 6, 2012 18:22
Phake examples
<?php
public function testProcessSomeDataLogsExceptions() {
$logger = Phake::mock('LOGGER');
$data = Phake::mock('MyData');
$processor = Phake::mock('MyDataProcessor');
Phake::when($processor)->process($data)
->thenThrow(new Exception('My error message!'));