Skip to content

Instantly share code, notes, and snippets.

View petersuhm's full-sized avatar

Peter Suhm petersuhm

View GitHub Profile
@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
@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 / 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 / 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 / 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
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 / 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;
/**
@petersuhm
petersuhm / AppServiceProvider.php
Last active August 29, 2015 14:27
Bind a class to current authenticated object in a multi tenant app.
<?php
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
@petersuhm
petersuhm / Usage
Last active August 1, 2018 13:10
Docker Compose file I use during development of WP Pusher
$ docker-compose up -d
Creating network "wppusherplugin_default" with the default driver
Creating wppusherplugin_db_1
Creating wppusherplugin_wordpress_1
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ecec64717d29 wordpress:php5.6-apache "docker-entrypoint.sh" 5 seconds ago Up 2 seconds 0.0.0.0:80->80/tcp wppusherplugin_wordpress_1
54ed735f15e4 mysql:5.7 "docker-entrypoint.sh" 7 seconds ago Up 4 seconds 3306/tcp wppusherplugin_db_1
@petersuhm
petersuhm / docker-compose.yml
Created February 20, 2017 20:51
Docker Compose file for WP Pusher
version: '2'
services:
db:
image: mysql:5.7
volumes:
- wp_pusher_db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress