mscherer 9 years ago
parent
commit
4d6455b0e3

+ 2 - 5
docs/Contributing.md

@@ -13,11 +13,8 @@ I am looking forward to your contributions. There are several ways to help out:
 * Write patches for bugs/features, preferably with testcases included
 
 There are a few guidelines that I need contributors to follow:
-* Coding standards (see link below)
-* Passing tests (you can enable travis to assert your changes pass) for Windows and Unix
-
-Protip: Use my [MyCakePHP](https://github.com/dereuromark/cakephp-codesniffer/tree/master/Vendor/PHP/CodeSniffer/Standards/MyCakePHP) sniffs to
-assert coding standards are met. You can either use this pre-build repo and the convenience shell command `cake CodeSniffer.CodeSniffer run -p Tools --standard=MyCakePHP` or the manual `phpcs --standard=MyCakePHP /path/to/Tools`.
+* Coding standards (`./sniff` to check and `./sniff -f` to fix)
+* Passing tests (you can enable travis to assert your changes pass) for Windows and Unix (`php phpunit.phar`)
 
 # Additional Resources
 

+ 18 - 0
sniff

@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# Make sure this file is executable
+# chmod +x sniff
+
+if [ `echo "$@" | grep '\-\-fix'` ] || [ `echo "$@" | grep '\-f'` ]; then
+    FIX=1
+else
+    FIX=0
+fi
+
+if [ "$FIX" = 1 ]; then
+	# Sniff and fix
+	vendor/bin/phpcbf --standard=vendor/fig-r/psr2r-sniffer/PSR2R/ruleset.xml --ignore=vendor/,tmp/,logs/,tests/test_files/ --extensions=php -v -f ./
+else
+	# Sniff only
+	vendor/bin/phpcs --standard=vendor/fig-r/psr2r-sniffer/PSR2R/ruleset.xml --ignore=vendor/,tmp/,logs/,tests/test_files/ --extensions=php -v ./
+fi

+ 12 - 12
tests/TestApp/Controller/CommonComponentTestController.php

@@ -8,19 +8,19 @@ use Tools\Controller\Controller;
  */
 class CommonComponentTestController extends Controller {
 
-    /**
-     * @var string
-     */
-    public $name = 'MyController';
+	/**
+	 * @var string
+	 */
+	public $name = 'MyController';
 
-    /**
-     * @var array
-     */
-    public $components = ['Tools.Common'];
+	/**
+	 * @var array
+	 */
+	public $components = ['Tools.Common'];
 
-    /**
-     * @var array
-     */
-    public $autoRedirectActions = ['allowed'];
+	/**
+	 * @var array
+	 */
+	public $autoRedirectActions = ['allowed'];
 
 }

+ 26 - 26
tests/TestApp/Controller/FlashComponentTestController.php

@@ -8,31 +8,31 @@ use Tools\Controller\Controller;
  */
 class FlashComponentTestController extends Controller {
 
-    /**
-     * @var array
-     */
-    public $components = ['Tools.Flash'];
-
-    /**
-     * @var bool
-     */
-    public $failed = false;
-
-    /**
-     * @var array
-     */
-    public $testHeaders = [];
-
-    public function fail() {
-        $this->failed = true;
-    }
-
-    public function redirect($url, $status = null, $exit = true) {
-        return $status;
-    }
-
-    public function header($status) {
-        $this->testHeaders[] = $status;
-    }
+	/**
+	 * @var array
+	 */
+	public $components = ['Tools.Flash'];
+
+	/**
+	 * @var bool
+	 */
+	public $failed = false;
+
+	/**
+	 * @var array
+	 */
+	public $testHeaders = [];
+
+	public function fail() {
+		$this->failed = true;
+	}
+
+	public function redirect($url, $status = null, $exit = true) {
+		return $status;
+	}
+
+	public function header($status) {
+		$this->testHeaders[] = $status;
+	}
 
 }

+ 6 - 6
tests/TestApp/Controller/MobileComponentTestController.php

@@ -5,11 +5,11 @@ use Tools\Controller\Controller;
 
 class MobileComponentTestController extends Controller {
 
-    /**
-     * Components property
-     *
-     * @var array
-     */
-    public $components = ['RequestHandler', 'Tools.Mobile'];
+	/**
+	 * Components property
+	 *
+	 * @var array
+	 */
+	public $components = ['RequestHandler', 'Tools.Mobile'];
 
 }

+ 1 - 1
tests/TestCase/Controller/Component/AuthUserComponentTest.php

@@ -2,8 +2,8 @@
 
 namespace Tools\Test\TestCase\Controller\Component;
 
-use Cake\Controller\Component\AuthComponent;
 use Cake\Controller\ComponentRegistry;
+use Cake\Controller\Component\AuthComponent;
 use Cake\Controller\Controller;
 use Cake\Network\Request;
 use Tools\Controller\Component\AuthUserComponent;

+ 0 - 2
tests/TestCase/Controller/Component/FlashComponentTest.php

@@ -12,8 +12,6 @@ use Tools\TestSuite\TestCase;
  */
 class FlashComponentTest extends TestCase {
 
-	//public $fixtures = array('core.sessions', 'plugin.tools.tools_users', 'plugin.tools.roles');
-
 	/**
 	 * @var \TestApp\Controller\FlashComponentTestController
 	 */