mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
parent
64a2742246
commit
92ab25c582
4
.github/workflows/tests.yml
vendored
4
.github/workflows/tests.yml
vendored
@ -30,10 +30,10 @@ jobs:
|
||||
run: npm run test
|
||||
phpUnitTests:
|
||||
strategy:
|
||||
max-parallel: 6
|
||||
max-parallel: 8
|
||||
matrix:
|
||||
operatingSystem: [ubuntu-latest, windows-latest]
|
||||
phpVersion: ['7.2', '7.3', '7.4']
|
||||
phpVersion: ['7.2', '7.3', '7.4', '8.0']
|
||||
fail-fast: false
|
||||
runs-on: ${{ matrix.operatingSystem }}
|
||||
name: ${{ matrix.operatingSystem }} / PHP ${{ matrix.phpVersion }}
|
||||
|
@ -31,7 +31,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.2",
|
||||
"php": ">=7.2.9",
|
||||
"october/rain": "1.1.*",
|
||||
"october/system": "1.1.*",
|
||||
"october/backend": "1.1.*",
|
||||
@ -45,8 +45,7 @@
|
||||
"fzaninotto/faker": "~1.9",
|
||||
"squizlabs/php_codesniffer": "3.*",
|
||||
"php-parallel-lint/php-parallel-lint": "^1.0",
|
||||
"meyfa/phpunit-assert-gd": "^2.0.0",
|
||||
"dms/phpunit-arraysubset-asserts": "^0.1.0"
|
||||
"dms/phpunit-arraysubset-asserts": "^0.1.0|^0.2.1"
|
||||
},
|
||||
"autoload-dev": {
|
||||
"classmap": [
|
||||
@ -76,10 +75,7 @@
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
"preferred-install": "dist",
|
||||
"platform": {
|
||||
"php": "7.2.5"
|
||||
}
|
||||
"preferred-install": "dist"
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
|
@ -111,6 +111,14 @@ class BackendController extends ControllerBase
|
||||
self::extendableExtendCallback($callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function callAction($method, $parameters)
|
||||
{
|
||||
return parent::callAction($method, array_values($parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
* Pass unhandled URLs to the CMS Controller, if it exists
|
||||
*
|
||||
@ -210,7 +218,7 @@ class BackendController extends ControllerBase
|
||||
* Look for a Plugin controller
|
||||
*/
|
||||
if (count($params) >= 2) {
|
||||
list($author, $plugin) = $params;
|
||||
[$author, $plugin] = $params;
|
||||
|
||||
$pluginCode = ucfirst($author) . '.' . ucfirst($plugin);
|
||||
if (PluginManager::instance()->isDisabled($pluginCode)) {
|
||||
|
@ -617,7 +617,7 @@ class Controller extends ControllerBase
|
||||
$pageHandler = $this->action . '_' . $handler;
|
||||
|
||||
if ($this->methodExists($pageHandler)) {
|
||||
$result = call_user_func_array([$this, $pageHandler], $this->params);
|
||||
$result = call_user_func_array([$this, $pageHandler], array_values($this->params));
|
||||
return $result ?: true;
|
||||
}
|
||||
|
||||
@ -625,7 +625,7 @@ class Controller extends ControllerBase
|
||||
* Process page global handler (onSomething)
|
||||
*/
|
||||
if ($this->methodExists($handler)) {
|
||||
$result = call_user_func_array([$this, $handler], $this->params);
|
||||
$result = call_user_func_array([$this, $handler], array_values($this->params));
|
||||
return $result ?: true;
|
||||
}
|
||||
|
||||
@ -662,7 +662,7 @@ class Controller extends ControllerBase
|
||||
{
|
||||
$this->addViewPath($widget->getViewPaths());
|
||||
|
||||
$result = call_user_func_array([$widget, $handler], $this->params);
|
||||
$result = call_user_func_array([$widget, $handler], array_values($this->params));
|
||||
|
||||
$this->vars = $widget->vars + $this->vars;
|
||||
|
||||
|
@ -464,7 +464,7 @@ class CombineAssets
|
||||
*/
|
||||
protected function setHashOnCombinerFilters($hash)
|
||||
{
|
||||
$allFilters = call_user_func_array('array_merge', $this->getFilters());
|
||||
$allFilters = array_merge(...array_values($this->getFilters()));
|
||||
|
||||
foreach ($allFilters as $filter) {
|
||||
if (method_exists($filter, 'setHash')) {
|
||||
|
@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\Assert;
|
||||
|
||||
class TestCase extends Illuminate\Foundation\Testing\TestCase
|
||||
{
|
||||
/**
|
||||
@ -51,4 +54,38 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
|
||||
$property->setAccessible(true);
|
||||
return $property->setValue($object, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stub for `assertFileNotExists` to allow compatibility with both PHPUnit 8 and 9.
|
||||
*
|
||||
* @param string $filename
|
||||
* @param string $message
|
||||
* @return void
|
||||
*/
|
||||
public static function assertFileNotExists(string $filename, string $message = ''): void
|
||||
{
|
||||
if (method_exists(Assert::class, 'assertFileDoesNotExist')) {
|
||||
Assert::assertFileDoesNotExist($filename, $message);
|
||||
return;
|
||||
}
|
||||
|
||||
Assert::assertFileNotExists($filename, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stub for `assertRegExp` to allow compatibility with both PHPUnit 8 and 9.
|
||||
*
|
||||
* @param string $filename
|
||||
* @param string $message
|
||||
* @return void
|
||||
*/
|
||||
public static function assertRegExp(string $pattern, string $string, string $message = ''): void
|
||||
{
|
||||
if (method_exists(Assert::class, 'assertMatchesRegularExpression')) {
|
||||
Assert::assertMatchesRegularExpression($pattern, $string, $message);
|
||||
return;
|
||||
}
|
||||
|
||||
Assert::assertRegExp($pattern, $string, $message);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace TestVendor\Goto;
|
||||
<?php namespace TestVendor\Goto
|
||||
|
||||
use System\Classes\PluginBase;
|
||||
|
||||
|
@ -61,7 +61,11 @@ class ExportModelTest extends TestCase
|
||||
$response->prepare($request);
|
||||
|
||||
$this->assertTrue($response->headers->has('Content-Type'), "Response is missing the Content-Type header!");
|
||||
$this->assertTrue($response->headers->contains('Content-Type', 'text/plain'), "Content-Type is not \"text/plain\"!");
|
||||
$this->assertTrue(
|
||||
$response->headers->contains('Content-Type', 'application/csv')
|
||||
|| $response->headers->contains('Content-Type', 'text/plain'),
|
||||
"Content-Type is not as expected!"
|
||||
);
|
||||
|
||||
ob_start();
|
||||
$response->send();
|
||||
|
Loading…
x
Reference in New Issue
Block a user