示例#1
0
 /**
  * test to valid issue #6
  * @see https://github.com/eviweb/fuelphp-phpcs/issues/6
  */
 public function testFixIssue6()
 {
     $sniffs = Helper::instance()->getAllSniffs();
     $pattern = '/(error|warning)\\s*=\\s*[\']([^\']*[\\r\\n]+[^\']*)[\']\\s*;/';
     $this->assertFalse(empty($sniffs));
     foreach ($sniffs as $sniff) {
         $result = preg_match_all($pattern, file_get_contents($sniff), $matches);
         $message = 'Invalid chars found in strings from: ' . $sniff . "\n" . print_r($matches, true);
         $this->assertTrue($result === 0, $message);
     }
 }
/* vim: set noexpandtab tabstop=8 shiftwidth=8 softtabstop=8: */
/**
 * The MIT License
 *
 * Copyright 2012 Eric VILLARD <*****@*****.**>.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 * 
 * @package     phpcs
 * @author      Eric VILLARD <*****@*****.**>
 * @copyright	(c) 2012 Eric VILLARD <*****@*****.**>
 * @license     http://opensource.org/licenses/MIT MIT License
 */
\evidev\fuelphp\phpcs\tests\helpers\Helper::instance()->requireSniff(basename(__DIR__) . DIRECTORY_SEPARATOR . basename(__FILE__));
示例#3
0
 /**
  * test to valid issue #5
  * @see https://github.com/eviweb/fuelphp-phpcs/issues/5
  */
 public function testFixIssue5()
 {
     $ruleset = Helper::instance()->getTestRuleset('variablename');
     $basefile = Helper::instance()->getErrorTestFile('variablename-fix-issue-5');
     $test = Helper::instance()->runPhpCsCli($basefile, $ruleset);
     // check errors and warnings
     $errors = $test['xml']->xpath('//error');
     $warnings = $test['xml']->xpath('//warning');
     $this->assertContains('$shouldBeSetInErrorMessage', (string) $errors[0]);
     $this->assertContains('$should_also_be_set_in_error_message_as_this_variable_name_is_too_long', (string) $warnings[0]);
 }
示例#4
0
 /**
  * test to valid issue #2
  * @see https://github.com/eviweb/fuelphp-phpcs/issues/2
  */
 function testFixIssue2()
 {
     $ruleset = Helper::instance()->getTestRuleset('fix-issue-2');
     //
     $test = Helper::instance()->runPhpCsCli(Helper::instance()->getWellFormedTestFile('tabindent-fix-issue-2'), $ruleset);
     $this->assertEquals(0, $test['errors']);
 }