Skip to content

Instantly share code, notes, and snippets.

View nojimage's full-sized avatar

Takashi Nojima nojimage

View GitHub Profile
@nojimage
nojimage / codeception.patch
Created March 8, 2016 03:18
codeception path fix for 2.1.5
diff --git a/vendor/codeception/codeception/src/Codeception/Lib/Parser.php b/vendor/codeception/codeception/src/Codeception/Lib/Parser.php
index 7e6987a..543b155 100644
--- a/vendor/codeception/codeception/src/Codeception/Lib/Parser.php
+++ b/vendor/codeception/codeception/src/Codeception/Lib/Parser.php
@@ -126,7 +126,7 @@ protected function addCommentStep($comment)
public static function validate($file)
{
- exec("php -l $file 2>&1", $output, $code);
+ exec("php -l '$file' 2>&1", $output, $code);
<?php
class SampleTest extends CakeTestCase
{
public function testSomething()
{
$this->// ここで補完
}
}
@nojimage
nojimage / phpcsmd-filepath.patch
Created November 17, 2015 07:27
for NetBeans phpcsmd plugin
diff --git a/src/de/foopara/phpcsmd/exec/pdepend/Pdepend.java b/src/de/foopara/phpcsmd/exec/pdepend/Pdepend.java
index ebb3d7b..339cf96 100644
--- a/src/de/foopara/phpcsmd/exec/pdepend/Pdepend.java
+++ b/src/de/foopara/phpcsmd/exec/pdepend/Pdepend.java
@@ -13,6 +13,8 @@ import de.foopara.phpcsmd.generics.GenericOutputReader;
import de.foopara.phpcsmd.generics.GenericProcess;
import de.foopara.phpcsmd.option.PdependOptions;
import de.foopara.phpcsmd.ui.reports.PdependReportTopComponent;
+import java.util.ArrayList;
+import java.util.List;
@nojimage
nojimage / Functional.suite.yml
Created September 1, 2015 09:50
Codeception / WebDriver / ChromeDriver でユーザーエージェントをセットする
class_name: FunctionalTester
namespace: App\Test\Functional
modules:
enabled:
- Cake\Codeception\Helper
- WebDriver
- App\TestSuite\Codeception\FunctionalHelper
config:
WebDriver:
url: 'http://localhost/'
@nojimage
nojimage / Inflector.diff
Last active August 29, 2015 14:22
Inflector fix
diff --git a/lib/Cake/Utility/Inflector.php b/lib/Cake/Utility/Inflector.php
index 61a63c2..48b9fa1 100644
--- a/lib/Cake/Utility/Inflector.php
+++ b/lib/Cake/Utility/Inflector.php
@@ -497,7 +497,7 @@ class Inflector {
public static function humanize($lowerCaseAndUnderscoredWord) {
if (!($result = self::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord))) {
$lowerCaseAndUnderscoredWord = self::underscore($lowerCaseAndUnderscoredWord);
- $result = explode(' ', str_replace('_', ' ', $lowerCaseAndUnderscoredWord));
+ $result = explode(' ', str_replace(['_', '.'], [' ', '. '], $lowerCaseAndUnderscoredWord));
@nojimage
nojimage / SwitchTestDatasource.php
Last active August 29, 2015 14:22
Switching datasource to test for CakePHP 3.x
<?php
/**
*
* Copyright 2015 ELASTIC Consultants Inc.
*
*/
namespace App\Routing\Filter;
@nojimage
nojimage / netbeans-baser-phpunit.sh
Created March 20, 2015 13:45
NetBeansからVagrant上のbaserCMSのテストを実行するためのスクリプト
#!/usr/bin/env bash
##
# Custom PHPUnit script for Remote test on NetBaeans 8.0
##
#
# Change these settings to your env
#
REMOTE_PKEY=~/.vagrant.d/insecure_private_key
REMOTE_SERVER=vagrant@192.168.33.10
#!/bin/env bash
##
# CVE-2015-0235 restart all services that using `glibc`
#
# original code:
# http://ma.ttias.be/critical-glibc-update-cve-2015-0235-gethostbyname-calls/#comment-10890
##
servicelist="";
for problemservice in `/usr/sbin/lsof 2> /dev/null | grep libc | awk '{print $1}' | sort -u`; do
@nojimage
nojimage / timecop
Last active August 29, 2015 14:13
php-build after-install.d
#!/usr/bin/env bash
TMP="/var/tmp/php-build"
PHP="/usr/bin/env php"
download_timecop() {
local timecop_url="$1"
if [ -z "$timecop_url" ]; then
timecop_url="https://github.com/hnw/php-timecop.git"
@nojimage
nojimage / env.php
Created December 11, 2014 11:39
phpdotenvで環境別設定を切り替えるための読み込みファイル
<?php
/**
* This file read before Configure::load('app')
*/
use Dotenv;
/**
* required setting
*/