Skip to content

Commit a25989f

Browse files
author
Anton
authored
Merge pull request #467 from bluzphp/develop
Added support Windows for tests
2 parents 78beeae + 9955782 commit a25989f

72 files changed

Lines changed: 617 additions & 901 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,14 @@ before_script:
2727
- chmod a+w ./tests/_output
2828
script:
2929
# Check code style
30-
#- php vendor/bin/phpcs --report=xml --report-file=.reports/phpcs.xml
31-
# Mess detection
32-
#- php vendor/bin/phpmd ./src xml codesize,unusedcode,naming --reportfile .reports/phpmd.xml || true
30+
- php vendor/bin/phpcs ./src --standard=PSR1,PSR2 --encoding=utf-8
3331
# Complexity of code
3432
- php vendor/bin/phploc ./src
3533
# Run CodeCeption tests
3634
- php vendor/bin/codecept run --coverage --coverage-xml
3735
after_success:
3836
# Upload coverage report
39-
- php vendor/bin/coveralls -v
37+
- php vendor/bin/php-coveralls -v
4038
- wget https://scrutinizer-ci.com/ocular.phar
4139
- php ocular.phar code-coverage:upload --format=php-clover tests/_output/coverage.xml
4240
# Generate documentation

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010
"ext-ctype": "*",
1111
"cache/cache": "~1.0",
1212
"psr/log": "~1.0",
13-
"zendframework/zend-diactoros": "~2.0",
13+
"zendframework/zend-diactoros": "~2.1.1",
1414
"zendframework/zend-httphandlerrunner": "~1.0"
1515
},
1616
"require-dev": {
1717
"codeception/codeception": "2.5.3",
1818
"php-coveralls/php-coveralls": "~2.1",
1919
"squizlabs/php_codesniffer": "~3.3",
20-
"phploc/phploc": "~4.0",
21-
"phpmd/phpmd": "~2.6"
20+
"phploc/phploc": "~4.0"
2221
},
2322
"suggest": {
2423
"ext-gettext": "required by Bluz\\Translator (https://github.com/bluzphp/framework/wiki/Translator)",

src/Grid/Grid.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public function getModule(): ?string
269269
/**
270270
* Set controller
271271
*
272-
* @param string $controller
272+
* @param string $controller
273273
*
274274
* @return void
275275
*/
@@ -321,15 +321,18 @@ public function processRequest(): void
321321
foreach ($this->allowOrders as $column) {
322322
$alias = $this->applyAlias($column);
323323
$order = Request::getParam($this->prefix . 'order-' . $alias);
324+
if (is_array($order)) {
325+
$order = current($order);
326+
}
324327
if (null !== $order) {
325328
$this->addOrder($column, $order);
326329
}
327330
}
328331
foreach ($this->allowFilters as $column) {
329332
$alias = $this->applyAlias($column);
330-
$filter = Request::getParam($this->prefix . 'filter-' . $alias);
333+
$filters = (array)Request::getParam($this->prefix . 'filter-' . $alias, []);
331334

332-
if (null !== $filter) {
335+
foreach ($filters as $filter) {
333336
$filter = trim($filter, ' _-');
334337
if (strpos($filter, '-')) {
335338
/**

src/Proxy/Mailer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
*
3232
* @method static Instance getInstance()
3333
*
34-
* @method static \PHPMailer create()
34+
* @method static \PHPMailer\PHPMailer\PHPMailer create()
3535
* @see Instance::create()
3636
*
37-
* @method static bool send(\PHPMailer $mail)
37+
* @method static bool send(\PHPMailer\PHPMailer\PHPMailer $mail)
3838
* @see Instance::send()
3939
*/
4040
final class Mailer

src/Proxy/Request.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
use Bluz\Common\Exception\ComponentException;
1414
use Bluz\Http\RequestMethod;
15-
use Bluz\Request\RequestFactory;
1615
use Psr\Http\Message\UriInterface;
1716
use Zend\Diactoros\ServerRequest as Instance;
1817

@@ -50,12 +49,12 @@ final class Request
5049
/**
5150
* @var array|null Accepted type
5251
*/
53-
static private $accept;
52+
private static $accept;
5453

5554
/**
5655
* @var array|null Accepted languages
5756
*/
58-
static private $language;
57+
private static $language;
5958

6059
/**
6160
* Init instance
@@ -75,7 +74,7 @@ private static function initInstance()
7574
* @param string $key
7675
* @param string $default Default value to use if key not found
7776
*
78-
* @return string Returns null if key does not exist
77+
* @return string|array|null Returns null if key does not exist
7978
*/
8079
public static function getQuery($key = null, $default = null)
8180
{
@@ -90,7 +89,7 @@ public static function getQuery($key = null, $default = null)
9089
* @param string $key
9190
* @param string $default Default value to use if key not found
9291
*
93-
* @return string Returns null if key does not exist
92+
* @return string|array|null Returns null if key does not exist
9493
*/
9594
public static function getPost($key = null, $default = null)
9695
{
@@ -169,7 +168,7 @@ public static function getHeader($header, $default = null)
169168
* @param string $key
170169
* @param null $default
171170
*
172-
* @return string|null
171+
* @return string|array|null
173172
* @link http://msdn.microsoft.com/en-us/library/system.web.httprequest.item.aspx
174173
*/
175174
public static function getParam($key, $default = null)
@@ -185,11 +184,11 @@ public static function getParam($key, $default = null)
185184
*
186185
* @return array
187186
*/
188-
public static function getParams()
187+
public static function getParams(): array
189188
{
190189
$body = (array)self::getInstance()->getParsedBody();
191190
$query = (array)self::getInstance()->getQueryParams();
192-
return array_merge($body, $query);
191+
return array_merge([], $body, $query);
193192
}
194193

195194
/**
@@ -303,7 +302,7 @@ private static function parseAcceptHeader($header): array
303302
// the default quality is 1.
304303
$q = 1;
305304
// check if there is a different quality
306-
if (strpos($a, ';q=') or strpos($a, '; q=')) {
305+
if (strpos($a, ';q=') || strpos($a, '; q=')) {
307306
// divide "mime/type;q=X" into two parts: "mime/type" i "X"
308307
[$a, $q] = preg_split('/;([ ]?)q=/', $a);
309308
}

src/Proxy/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public static function redirect($url): void
125125
* @return void
126126
* @throws RedirectException
127127
*/
128-
public static function redirectTo($module = 'index', $controller = 'index', array $params = []): void
128+
public static function redirectTo($module, $controller = 'index', array $params = []): void
129129
{
130130
$url = Router::getFullUrl($module, $controller, $params);
131131
self::redirect($url);

tests/_bootstrap.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
// This is global bootstrap for autoloading
33
// Environment
44
define('DEBUG', true);
5-
error_reporting(E_ALL | E_STRICT);
5+
error_reporting(E_ALL);
66
ini_set('display_errors', 1);
77

88
// Paths
99
define('PATH_ROOT', realpath(dirname(__DIR__)));
10-
define('PATH_APPLICATION', PATH_ROOT . '/tests');
11-
define('PATH_VENDOR', PATH_ROOT . '/vendor');
10+
define('PATH_APPLICATION', PATH_ROOT . DIRECTORY_SEPARATOR . 'tests');
11+
define('PATH_VENDOR', PATH_ROOT . DIRECTORY_SEPARATOR . 'vendor');
1212

1313
// Use composer autoload
1414
$loader = require PATH_ROOT . '/vendor/autoload.php';
15-
$loader->addPsr4('Bluz\\Tests\\', __DIR__ . '/src');
15+
$loader->addPsr4('Bluz\\Tests\\', __DIR__ . DIRECTORY_SEPARATOR . 'src');

0 commit comments

Comments
 (0)