Closed kenjis closed 2 years ago
The file could be fixed with non PARALLEL mode.
1) tests/system/Validation/StrictRules/ValidationTest.php:26
---------- begin diff ----------
@@ @@
*/
final class ValidationTest extends CIUnitTestCase
{
- /**
- * @var Validation
- */
- private $validation;
+ private Validation $validation;
- private $config = [
+ private array $config = [
'ruleSets' => [
Rules::class,
FormatRules::class,
----------- end diff -----------
Applied rules:
* TypedPropertyRector (https://wiki.php.net/rfc/typed_properties_v2#proposal)
@kenjis thank you, the TypedPropertyRector
seems somehow try load esc()
function when autoload is lost during parallel process.
It possibly need update on TypedPropertyRector
to not call actual result of file_get_contents()
on render view on Validation::listErrors()
@kenjis it seems somehow when read the array:
'single' => 'CodeIgniter\Validation\Views\single',
it marked as class on parallel.
@kenjis the solution I found right now for your parallel use case is to move the config to tests/_support/Config/Validation.php
to be included, eg:
<?php
namespace Tests\Support\Config;
class Validation
{
public const CONFIG = [
'ruleSets' => [
Rules::class,
FormatRules::class,
FileRules::class,
CreditCardRules::class,
TestRules::class,
],
'groupA' => [
'foo' => 'required|min_length[5]',
],
'login' => [
'username' => [
'label' => 'Username',
'rules' => 'required',
'errors' => [
'required' => 'custom username required error msg.',
],
],
'password' => [
'label' => 'Password',
'rules' => 'required',
'errors' => [
'required' => 'custom password required error msg.',
],
],
],
'groupA_errors' => [
'foo' => [
'min_length' => 'Shame, shame. Too short.',
],
],
'groupX' => 'Not an array, so not a real group',
'templates' => [
'list' => 'CodeIgniter\Validation\Views\list',
'single' => 'CodeIgniter\Validation\Views\single',
],
];
}
So in your ValidationTest.php
, you can use:
private array $config = \Tests\Support\Config\Validation::CONFIG;
Closing as answered. We're narrowing issues to keep focus on active and engaging contributor to keep project growing. Thank you for understanding.
@TomasVotruba If you could help me and just let know where to add the parallel code, I would appreciate it. I am not sure why my last post was deleted.
How to reproduce:
Environment: