Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Improve for windows #9318

Draft
wants to merge 2 commits into
base: 4.6
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@
],
"metrics": "utils/vendor/bin/phpmetrics --config=phpmetrics.json",
"phpstan:baseline": "vendor/bin/phpstan analyse --ansi --generate-baseline=phpstan-baseline.php",
"phpstan:check": "vendor/bin/phpstan analyse --verbose --ansi",
"phpstan:check": "vendor/bin/phpstan analyse --verbose --ansi --memory-limit 2G",
"sa": "@analyze",
"style": "@cs-fix",
"test": "phpunit"
"test": "phpunit --no-coverage"
},
"scripts-descriptions": {
"analyze": "Run static analysis",
Expand Down
202 changes: 202 additions & 0 deletions errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
15) CodeIgniter\Files\FileCollectionTest::testResolveDirectorySymlink
ErrorException: symlink(): Permission denied
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To bypass the issue related to Permission denied rights, you can run your terminal with "Run as Administrator" privileges.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know about it.

Copy link
Member

@paulbalandan paulbalandan Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can skip the test when in windows by adding a @requires OS Linux phpdoc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is undesirable to skip it. More useful to show a notification of admin rights.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but how for Github actions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no actions under windows right now. The tests are completed. You can check is_windows() and show a warning. Or describe this case in the documentation


E:\www\CodeIgniterProjects\dev\tests\system\Files\FileCollectionTest.php:69

16) CodeIgniter\Files\FileCollectionTest::testResolveFileSymlink
ErrorException: symlink(): Permission denied

E:\www\CodeIgniterProjects\dev\tests\system\Files\FileCollectionTest.php:89

17) CodeIgniter\HTTP\Files\FileMovingTest::testStore
ErrorException: mkdir(): No such file or directory

E:\www\CodeIgniterProjects\dev\system\HTTP\Files\UploadedFile.php:181
E:\www\CodeIgniterProjects\dev\system\HTTP\Files\UploadedFile.php:135
E:\www\CodeIgniterProjects\dev\system\HTTP\Files\UploadedFile.php:355
E:\www\CodeIgniterProjects\dev\tests\system\HTTP\Files\FileMovingTest.php:213

18) CodeIgniter\Helpers\FilesystemHelperTest::testGetFilenamesWithSymlinks
ErrorException: symlink(): Permission denied

E:\www\CodeIgniterProjects\dev\tests\system\Helpers\FilesystemHelperTest.php:408

19) CodeIgniter\Helpers\FilesystemHelperTest::testGetFileNotThereInfo
TypeError: basename(): Argument #1 ($path) must be of type string, false given

E:\www\CodeIgniterProjects\dev\system\Helpers\filesystem_helper.php:322
E:\www\CodeIgniterProjects\dev\tests\system\Helpers\FilesystemHelperTest.php:525

20) CodeIgniter\Publisher\PublisherInputTest::testAddUri
CodeIgniter\HTTP\Exceptions\HTTPException: 60 : SSL certificate problem: unable to get local issuer certificate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this issue is related to an incorrect configuration on your system. I do not have this problem. Please try to resolve it by referring to the link below:

https://stackoverflow.com/questions/35638497/curl-error-60-ssl-certificate-prblm-unable-to-get-local-issuer-certificate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I used to disable validation in other scripts. I didn't get an error. If the PR is approved, it will be described in the documentation


E:\www\CodeIgniterProjects\dev\system\HTTP\CURLRequest.php:709
E:\www\CodeIgniterProjects\dev\system\HTTP\CURLRequest.php:383
E:\www\CodeIgniterProjects\dev\system\HTTP\CURLRequest.php:152
E:\www\CodeIgniterProjects\dev\system\HTTP\CURLRequest.php:187
E:\www\CodeIgniterProjects\dev\system\Publisher\Publisher.php:331
E:\www\CodeIgniterProjects\dev\tests\system\Publisher\PublisherInputTest.php:140

21) CodeIgniter\Publisher\PublisherInputTest::testAddUris
CodeIgniter\HTTP\Exceptions\HTTPException: 60 : SSL certificate problem: unable to get local issuer certificate

E:\www\CodeIgniterProjects\dev\system\HTTP\CURLRequest.php:709
E:\www\CodeIgniterProjects\dev\system\HTTP\CURLRequest.php:383
E:\www\CodeIgniterProjects\dev\system\HTTP\CURLRequest.php:152
E:\www\CodeIgniterProjects\dev\system\HTTP\CURLRequest.php:187
E:\www\CodeIgniterProjects\dev\system\Publisher\Publisher.php:331
E:\www\CodeIgniterProjects\dev\system\Publisher\Publisher.php:312
E:\www\CodeIgniterProjects\dev\tests\system\Publisher\PublisherInputTest.php:150

22) CodeIgniter\Publisher\PublisherSupportTest::testWipe
CodeIgniter\Publisher\Exceptions\PublisherException: Destination is not on the allowed list of Publisher directories: "C:/Users/aleksandr/AppData/Local/Temp/2d8bc0469a5a/"

E:\www\CodeIgniterProjects\dev\system\Publisher\Publisher.php:183
E:\www\CodeIgniterProjects\dev\tests\system\Publisher\PublisherSupportTest.php:166

--

There were 6 failures:

1) CodeIgniter\CodeIgniterTest::testRun404OverrideControllerReturnsResponse
Failed asserting that '<!-- DEBUG-VIEW START 1 APPPATH/Views/welcome_message.php -->\n
<!DOCTYPE html>\n
<html lang="en">\n
<head>\n
<meta charset="UTF-8">\n
<title>Welcome to CodeIgniter 4!</title>\n
<meta name="description" content="The small framework with powerful features">\n
<meta name="viewport" content="width=device-width, initial-scale=1.0">\n
<link rel="shortcut icon" type="image/png" href="/favicon.ico">\n
...
</body>\n
</html>\n
\n
<!-- DEBUG-VIEW ENDED 1 APPPATH/Views/welcome_message.php -->\n
' [ASCII](length: 17399) contains "Oops" [ASCII](length: 4).

E:\www\CodeIgniterProjects\dev\tests\system\CodeIgniterTest.php:164

2) CodeIgniter\CodeIgniterTest::testRun404OverrideReturnResponse
Failed asserting that '<!-- DEBUG-VIEW START 1 APPPATH/Views/welcome_message.php -->\n
<!DOCTYPE html>\n
<html lang="en">\n
<head>\n
<meta charset="UTF-8">\n
<title>Welcome to CodeIgniter 4!</title>\n
<meta name="description" content="The small framework with powerful features">\n
<meta name="viewport" content="width=device-width, initial-scale=1.0">\n
<link rel="shortcut icon" type="image/png" href="/favicon.ico">\n
...
</body>\n
</html>\n
\n
<!-- DEBUG-VIEW ENDED 1 APPPATH/Views/welcome_message.php -->\n
' [ASCII](length: 17400) contains "Oops" [ASCII](length: 4).

E:\www\CodeIgniterProjects\dev\tests\system\CodeIgniterTest.php:182

3) CodeIgniter\CodeIgniterTest::testRun404OverrideByClosure
Failed asserting that '<!-- DEBUG-VIEW START 1 APPPATH/Views/welcome_message.php -->\n
<!DOCTYPE html>\n
<html lang="en">\n
<head>\n
<meta charset="UTF-8">\n
<title>Welcome to CodeIgniter 4!</title>\n
<meta name="description" content="The small framework with powerful features">\n
<meta name="viewport" content="width=device-width, initial-scale=1.0">\n
<link rel="shortcut icon" type="image/png" href="/favicon.ico">\n
...
</body>\n
</html>\n
\n
<!-- DEBUG-VIEW ENDED 1 APPPATH/Views/welcome_message.php -->\n
' [ASCII](length: 17365) contains "404 Override by Closure." [ASCII](length: 24).

E:\www\CodeIgniterProjects\dev\tests\system\CodeIgniterTest.php:203

4) CodeIgniter\Commands\Database\ShowTableInfoMockIOTest::testDbTableWithInputs
Failed asserting that '+-----------+----------+----------+----------+----------+------+\n
| hostname | database | username | DBDriver | DBPrefix | port |\n
+-----------+----------+----------+----------+----------+------+\n
| 127.0.0.1 | :memory: | | SQLite3 | db_ | 3306 |\n
+-----------+----------+----------+----------+----------+------+\n
\n
Here is the list of your database tables:\n
[0] db_migrations\n
[82] db_user\n
[83] db_job\n
[84] db_misc\n
[85] db_type_test\n
[86] db_empty\n
[87] db_secondary\n
[88] db_stringifypkey\n
[89] db_without_auto_increment\n
[90] db_ip_table\n
[92] db_foo\n
\n
Which table do you want to see? [0, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92]: a\n
The "Which table do you want to see?" field must be one of: 0, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92.\n
\n
Which table do you want to see? [0, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92]: 0\n
\n
Data of Table "db_migrations":\n
\n
+----+----------------+--------------------+-------+---------------+------------+-------+\n
| id | version | class | group | namespace | time | batch |\n
+----+----------------+--------------------+-------+---------------+------------+-------+\n
| 14 | 20160428212500 | Tests\Support\D... | tests | Tests\Support | 1733827161 | 1 |\n
+----+----------------+--------------------+-------+---------------+------------+-------+\n
\n
' matches PCRE pattern "/Which table do you want to see\? \[0, 1, 2, 3, 4, 5, 6, 7, 8, 9.*?\]: a
The "Which table do you want to see\?" field must be one of: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.*?./".

E:\www\CodeIgniterProjects\dev\tests\system\Commands\Database\ShowTableInfoMockIOTest.php:63

5) CodeIgniter\Commands\Database\ShowTableInfoTest::testDbTableShow
Failed asserting that '+-----------+----------+----------+----------+----------+------+\n
| hostname | database | username | DBDriver | DBPrefix | port |\n
+-----------+----------+----------+----------+----------+------+\n
| 127.0.0.1 | :memory: | | SQLite3 | db_ | 3306 |\n
+-----------+----------+----------+----------+----------+------+\n
\n
The following is a list of the names of all database tables:\n
\n
+-----+---------------------------+-------------+---------------+\n
| ID | Table Name | Num of Rows | Num of Fields |\n
+-----+---------------------------+-------------+---------------+\n
| 1 | db_migrations | 1 | 7 |\n
| 93 | db_foo | 1 | 1 |\n
| 94 | db_user | 0 | 7 |\n
| 95 | db_job | 0 | 6 |\n
| 96 | db_misc | 0 | 3 |\n
| 97 | db_type_test | 0 | 21 |\n
| 98 | db_empty | 0 | 4 |\n
| 99 | db_secondary | 0 | 3 |\n
| 100 | db_stringifypkey | 0 | 2 |\n
| 101 | db_without_auto_increment | 0 | 2 |\n
| 102 | db_ip_table | 0 | 2 |\n
+-----+---------------------------+-------------+---------------+\n
\n
\n
' [ASCII](length: 1380) contains "+----+---------------------------+-------------+---------------+
| ID | Table Name | Num of Rows | Num of Fields |
+----+---------------------------+-------------+---------------+" [ASCII](length: 194).

E:\www\CodeIgniterProjects\dev\tests\system\Commands\Database\ShowTableInfoTest.php:103

6) CodeIgniter\Security\CheckPhpIniTest::testCheckIni
Failed asserting that two arrays are identical.
--- Expected
+++ Actual
@@ @@
Array &0 [
- 'global' => '',
+ 'global' => '1',
'current' => '1',
'recommended' => '0',
'remark' => '',
]

E:\www\CodeIgniterProjects\dev\tests\system\Security\CheckPhpIniTest.php:37

14 changes: 4 additions & 10 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -12235,12 +12235,6 @@
'count' => 1,
'path' => __DIR__ . '/tests/system/CommonFunctionsTest.php',
];
$ignoreErrors[] = [
// identifier: missingType.iterableValue
'message' => '#^Method CodeIgniter\\\\CommonFunctionsTest\\:\\:provideCleanPathActuallyCleaningThePaths\\(\\) return type has no value type specified in iterable type iterable\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/CommonFunctionsTest.php',
];
$ignoreErrors[] = [
// identifier: codeigniter.modelArgumentType
'message' => '#^Parameter \\#1 \\$name of function model expects a valid class string, \'JobModel\' given\\.$#',
Expand Down Expand Up @@ -13071,15 +13065,15 @@
];
$ignoreErrors[] = [
// identifier: property.notFound
'message' => '#^Access to an undefined property CodeIgniter\\\\Database\\\\BaseConnection\\:\\:\\$numberNative\\.$#',
'message' => '#^Access to an undefined property CodeIgniter\\\\Database\\\\BaseConnection\\:\\:\\$foundRows\\.$#',
'count' => 2,
'path' => __DIR__ . '/tests/system/Database/Live/MySQLi/NumberNativeTest.php',
'path' => __DIR__ . '/tests/system/Database/Live/MySQLi/FoundRowsTest.php',
];
$ignoreErrors[] = [
// identifier: property.notFound
'message' => '#^Access to an undefined property CodeIgniter\\\\Database\\\\BaseConnection\\:\\:\\$foundRows\\.$#',
'message' => '#^Access to an undefined property CodeIgniter\\\\Database\\\\BaseConnection\\:\\:\\$numberNative\\.$#',
'count' => 2,
'path' => __DIR__ . '/tests/system/Database/Live/MySQLi/FoundRowsTest.php',
'path' => __DIR__ . '/tests/system/Database/Live/MySQLi/NumberNativeTest.php',
];
$ignoreErrors[] = [
// identifier: missingType.property
Expand Down
121 changes: 61 additions & 60 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,63 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="system/Test/bootstrap.php"
backupGlobals="false"
beStrictAboutOutputDuringTests="true"
colors="true"
columns="max"
failOnRisky="true"
failOnWarning="true"
cacheDirectory="build/.phpunit.cache">
<coverage
includeUncoveredFiles="true"
pathCoverage="false"
ignoreDeprecatedCodeUnits="true"
disableCodeCoverageIgnore="true">
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/coverage/html" highLowerBound="80"/>
<text outputFile="build/coverage/coverage.txt"/>
</report>
</coverage>
<extensions>
<bootstrap class="Nexus\PHPUnit\Tachycardia\TachycardiaExtension">
<parameter name="time-limit" value="0.50" />
<parameter name="report-count" value="30" />
</bootstrap>
</extensions>
<testsuites>
<testsuite name="System">
<directory>tests/system</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">system</directory>
</include>
<exclude>
<directory>system/Commands/Generators/Views</directory>
<directory>system/Debug/Toolbar/Views</directory>
<directory>system/Pager/Views</directory>
<directory>system/ThirdParty</directory>
<directory>system/Validation/Views</directory>
<file>system/bootstrap.php</file>
<file>system/ComposerScripts.php</file>
<file>system/Config/Routes.php</file>
<file>system/Test/bootstrap.php</file>
<file>system/Test/ControllerTester.php</file>
<file>system/Test/FeatureTestCase.php</file>
</exclude>
</source>
<php>
<server name="app.baseURL" value="http://example.com/"/>
<server name="CODEIGNITER_SCREAM_DEPRECATIONS" value="1"/>
<!-- Directory containing phpunit.xml -->
<const name="HOMEPATH" value="./"/>
<!-- Directory containing the Paths config file -->
<const name="CONFIGPATH" value="./app/Config/"/>
<!-- Directory containing the front controller (index.php) -->
<const name="PUBLICPATH" value="./public/"/>
</php>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what changed here? line indents?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Enable showing deprecations in console - autoreformat file.

xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
bootstrap="system/Test/bootstrap.php"
backupGlobals="false"
beStrictAboutOutputDuringTests="true"
colors="true"
columns="max"
failOnRisky="true"
failOnWarning="true"
cacheDirectory="build/.phpunit.cache"
>
<coverage
pathCoverage="false"
ignoreDeprecatedCodeUnits="true"
disableCodeCoverageIgnore="false"
>
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/coverage/html" highLowerBound="80"/>
<text outputFile="build/coverage/coverage.txt"/>
</report>
</coverage>
<extensions>
<bootstrap class="Nexus\PHPUnit\Tachycardia\TachycardiaExtension">
<parameter name="time-limit" value="0.50"/>
<parameter name="report-count" value="30"/>
</bootstrap>
</extensions>
<testsuites>
<testsuite name="System">
<directory>tests/system</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">system</directory>
</include>
<exclude>
<directory>system/Commands/Generators/Views</directory>
<directory>system/Debug/Toolbar/Views</directory>
<directory>system/Pager/Views</directory>
<directory>system/ThirdParty</directory>
<directory>system/Validation/Views</directory>
<file>system/bootstrap.php</file>
<file>system/ComposerScripts.php</file>
<file>system/Config/Routes.php</file>
<file>system/Test/bootstrap.php</file>
<file>system/Test/ControllerTester.php</file>
<file>system/Test/FeatureTestCase.php</file>
</exclude>
</source>
<php>
<server name="app.baseURL" value="http://example.com/"/>
<server name="CODEIGNITER_SCREAM_DEPRECATIONS" value="1"/>
<!-- Directory containing phpunit.xml -->
<const name="HOMEPATH" value="./"/>
<!-- Directory containing the Paths config file -->
<const name="CONFIGPATH" value="./app/Config/"/>
<!-- Directory containing the front controller (index.php) -->
<const name="PUBLICPATH" value="./public/"/>
</php>
</phpunit>
Loading
Loading