Skip to content

Instantly share code, notes, and snippets.

View petersuhm's full-sized avatar

Peter Suhm petersuhm

View GitHub Profile
@petersuhm
petersuhm / ProductOverviewTest.php
Last active August 29, 2015 14:23
Laravel 5.1 test example
<?php
use Illuminate\Foundation\Testing\DatabaseMigrations;
use WpShop\Product;
class ProductOverviewTest extends TestCase
{
use DatabaseMigrations;
/**
Listen 8080
<VirtualHost *:8080>
LoadModule php5_module /home/ubuntu/.phpenv/versions/5.3.3/libexec/apache2/libphp5.so
DocumentRoot /home/ubuntu/wppusher-plugin/wordpress
ServerName wppusher-plugin.dev
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
@petersuhm
petersuhm / circle.yml
Last active May 4, 2024 15:27
Example CircleCi configuration for WP Pusher
machine:
timezone:
Europe/Copenhagen
php:
version: 5.3.3
# This will be added to the `/etc/hosts` file
hosts:
wppusher-plugin.dev: 127.0.0.1
@petersuhm
petersuhm / LaravelHandlerLocator.php
Created March 1, 2015 18:39
Command handler locator for Tactician (http://tactician.thephpleague.com/).
<?php
namespace WpShipper\Handlers\Commands;
use Illuminate\Foundation\Application;
use League\Tactician\Command;
use League\Tactician\Handler\Locator\HandlerLocator;
class LaravelHandlerLocator implements HandlerLocator
{
@petersuhm
petersuhm / wppusher.php
Created February 19, 2015 08:34
Example wppusher.php file for running Composer.
<?php
return array(
// Each string will be passed to the shell as a command.
'commands' => array(
'composer install',
),
// Defaults to true and is not required.
// If set to false, installing and update can take a long time
// and may seem like it's 'hanging'.
// 'async' => false,
@petersuhm
petersuhm / ConversationsController.php
Created April 17, 2013 07:33
Laravel 4 nested resources. I had some trouble finding a good way to add nested resources in my routes.php file. Therfore, I thought I would share what I ended up with. Please say so, if you have any improvements to this :)
<?php
class ConversationsController extends BaseController {
public function show($user_id, $conversation_id)
{
var_dump($user_id);
var_dump($conversation_id);
}
@petersuhm
petersuhm / Testing-Laravel4.php
Created February 19, 2013 16:23
Simple Laravel 4 integration test, for testing a todo list application.
<?php
class TodoItemTest extends TestCase {
public function testCreateTodoItem()
{
// Visit create action and get crawler instance
$crawler = $this->client->request('GET', '/todo-items/create');
// Check that request returned 200