Skip to content
Permalink
Browse files

Tidied up tests.

  • Loading branch information...
SidRoberts authored and niden committed May 14, 2019
1 parent aa5b3ff commit a5a172e2118e43180be4d3788d2431a7625b0b6f
Showing 2,602 changed files with 3,133 additions and 7,723 deletions.
@@ -57,3 +57,5 @@ php_test_results_*.txt
docker-compose.yml
build/gccarch
tests/_cache

.php_cs.cache
@@ -0,0 +1,53 @@
<?php
$finder = PhpCsFixer\Finder::create()
->in('tests/')
->exclude('syntax/volt/');
return PhpCsFixer\Config::create()
->setRules(
[
'array_syntax' => ['syntax' => 'short'],
'align_multiline_comment' => true,
'blank_line_before_statement' => true,
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'dir_constant' => true,
'elseif' => true,
'fully_qualified_strict_types' => true,
'include' => true,
'lowercase_constants' => true,
'lowercase_keywords' => true,
'new_with_braces' => true,
'no_blank_lines_after_class_opening' => true,
'no_closing_tag' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_superfluous_phpdoc_tags' => true,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_unused_imports' => true,
'object_operator_without_whitespace' => true,
'ordered_imports' => true,
'php_unit_strict' => true,
'phpdoc_no_access' => true,
'phpdoc_no_package' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_scalar' => true,
'phpdoc_trim' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_var_without_name' => true,
'single_blank_line_at_eof' => true,
'single_import_per_statement' => true,
'single_line_after_imports' => true,
'single_quote' => true,
'standardize_not_equals' => true,
'standardize_increment' => true,
'strict_param' => true,
'ternary_operator_spaces' => true,
'trailing_comma_in_multiline_array' => true,
'visibility_required' => true,
]
)
->setFinder($finder);
@@ -48,6 +48,7 @@
"ext-psr": "0.6.0",
"ext-xml": "*",
"codeception/codeception": "^2.5",
"friendsofphp/php-cs-fixer": "~2.0",
"mustache/mustache": "^2.12",
"predis/predis": "^1.1",
"squizlabs/php_codesniffer": "^3.4",
@@ -17,7 +17,7 @@
clearstatcache();
$root = dirname(realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
$root = dirname(realpath(__DIR__) . DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
/**
* Setting this in the $_ENV so that DotLoad sets everything up properly
*/
@@ -61,7 +61,7 @@ public function %nn%%m%(UnitTester $I)
'%d%' => date('Y-m-d'),
];
$outputDir = dirname(dirname(__FILE__)) . '/nikos/';
$outputDir = dirname(__DIR__) . '/nikos/';
foreach ($phalconClasses as $class) {
$newClass = str_replace('Phalcon\\', '', $class);
@@ -79,30 +79,39 @@ public function %nn%%m%(UnitTester $I)
switch ($method) {
case '__construct':
$method = 'construct';
break;
case '__destruct':
$method = 'destruct';
break;
case '__toString':
$method = 'toString';
break;
case '__get':
$method = 'underscoreGet';
break;
case '__set':
$method = 'underscoreSet';
break;
case '__isset':
$method = 'underscoreIsSet';
break;
case '__unset':
$method = 'underscoreUnset';
break;
case '__wakeup':
$method = 'wakeup';
break;
case '__set_state':
$method = 'setState';
break;
}
@@ -16,7 +16,7 @@
/**
* Load environment
*/
$root = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR;
$root = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR;
loadEnvironment($root);
@@ -1,23 +1,23 @@
<?php
return [
"phalcon" => [
"baseuri" => "/phalcon/",
'phalcon' => [
'baseuri' => '/phalcon/',
],
"models" => [
"metadata" => "memory",
'models' => [
'metadata' => 'memory',
],
"database" => [
"adapter" => "mysql",
"host" => "localhost",
"username" => "user",
"password" => "passwd",
"name" => "demo",
'database' => [
'adapter' => 'mysql',
'host' => 'localhost',
'username' => 'user',
'password' => 'passwd',
'name' => 'demo',
],
"test" => [
"parent" => [
"property" => 1,
"property2" => "yeah",
'test' => [
'parent' => [
'property' => 1,
'property2' => 'yeah',
],
],
'issue-12725' => [
@@ -47,9 +47,6 @@ public function getUser()
return $this->user;
}
/**
* @return string
*/
public function getComponentName(): string
{
return $this->resourceName;
@@ -47,9 +47,6 @@ public function getId()
return $this->id;
}
/**
* @return string
*/
public function getRoleName(): string
{
return $this->roleName;
@@ -47,17 +47,11 @@ public function __construct($user, $componentName, $roleName)
$this->roleName = $roleName;
}
/**
* @return string
*/
public function getComponentName(): string
{
return $this->componentName;
}
/**
* @return string
*/
public function getRoleName(): string
{
return $this->roleName;
@@ -20,18 +20,14 @@ class TrimFilter implements FilterInterface
*
* @author Nikolaos Dimopoulos <nikos@phalconphp.com>
* @since 2014-10-05
*
* @param string $content
*
* @return string
*/
public function filter(string $content): string
{
return str_replace(
[
"\n",
"\r",
" ",
' ',
"\t",
],
'',
@@ -20,10 +20,6 @@ class UppercaseFilter implements FilterInterface
*
* @author Nikolaos Dimopoulos <nikos@phalconphp.com>
* @since 2014-10-05
*
* @param string $content
*
* @return string
*/
public function filter(string $content): string
{
@@ -21,9 +21,6 @@
*/
class Libmemcached extends CacheLibmemcached
{
/**
* @return array
*/
public function getOptions(): array
{
return $this->options;
@@ -14,8 +14,8 @@
+------------------------------------------------------------------------+
*/
use Phalcon\DiInterface;
use Phalcon\Di\ServiceProviderInterface;
use Phalcon\DiInterface;
class SomeServiceProvider implements ServiceProviderInterface
{
@@ -14,7 +14,7 @@
[
'type' => 'service',
'name' => 'config',
]
],
],
],
];
@@ -12,18 +12,13 @@
namespace Phalcon\Test\Fixtures\Filter\Sanitize;
/**
* Class IPv4
*/
class IPv4
{
/**
* Sanitizes IP addresses
*
* @param mixed $ip
*
* @return mixed
*/
public function __invoke($ip)
{
@@ -11,7 +11,6 @@
namespace Phalcon\Test\Fixtures\Helpers;
use Phalcon\Tag;
use UnitTester;
class TagHelper extends TagSetup
@@ -21,9 +21,6 @@ class TagSetup
protected $doctype = Tag::HTML5;
/**
* @param UnitTester $I
*/
public function _before(UnitTester $I)
{
$this->newDi();
@@ -43,8 +40,6 @@ public function _before(UnitTester $I)
* @author Phalcon Team <team@phalconphp.com>
* @since 2014-09-04
*
* @param $doctype
*
* @return string
*/
protected function docTypeStringToConstant(string $doctype)
@@ -122,9 +117,6 @@ protected function docTypeStringToConstant(string $doctype)
}
}
/**
* @param UnitTester $I
*/
public function _after(UnitTester $I)
{
Tag::setDocType($this->doctype);
@@ -134,9 +126,6 @@ public function _after(UnitTester $I)
/**
* Runs a doctype test, one for each doctype
*
* @param UnitTester $I
* @param int $doctype
*/
protected function runDoctypeTest(UnitTester $I, int $doctype)
{
@@ -145,8 +134,11 @@ protected function runDoctypeTest(UnitTester $I, int $doctype)
Tag::setDocType($doctype);
$expected = $this->docTypeToString($doctype);
$actual = Tag::getDocType();
$I->assertEquals($expected, $actual);
$I->assertEquals(
$expected,
Tag::getDocType()
);
}
/**
@@ -155,8 +147,6 @@ protected function runDoctypeTest(UnitTester $I, int $doctype)
* @author Phalcon Team <team@phalconphp.com>
* @since 2014-09-04
*
* @param int $doctype
*
* @return string
*/
protected function docTypeToString(int $doctype)
@@ -220,12 +210,10 @@ protected function docTypeToString(int $doctype)
/**
* Runs the test for a Tag::$function with $options
*
* @param \UnitTester $I
* @param string $function
* @param mixed $options
* @param string $expected
* @param boolean $xhtml
* @param string $set
* @param string $function
* @param string $expected
* @param bool $xhtml
* @param string $set
*/
protected function testFieldParameter(UnitTester $I, $function, $options, $expected, $xhtml = false, $set = '')
{

0 comments on commit a5a172e

Please sign in to comment.
You can’t perform that action at this time.