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

unable to run phpunit in tests directory #6206

Open
sneakyimp opened this issue Apr 10, 2023 · 1 comment
Open

unable to run phpunit in tests directory #6206

sneakyimp opened this issue Apr 10, 2023 · 1 comment

Comments

@sneakyimp
Copy link

I have encountered what appears to be a problem in the phpunit.xml file in the latest develop branch of CI3.

I posted another issue that the README file in the tests directory no longer works. I spent some time installing phpunit according to the latest instructions and I installed vfsStream using composer and tried to get around the error reported by composer on my MacOs laptop:

sed: 1: "vendor/mikey179/vfsstre ...": invalid command code v
Script sed -i s/name{0}/name[0]/ vendor/mikey179/vfsstream/src/main/php/org/bovigo/vfs/vfsstream.php handling the post-install-cmd event returned with error code 1

As suggested here I modified that sed statement as follows:

sed -i .bak s/name{0}/name[0]/ vendor/mikey179/vfsstream/src/main/php/org/bovigo/vfs/vfsstream.php

This seems to run. I do not know if this performs the necessary step, but phpunit appears to run now without vfstream complaints.

HOWEVER, phpunit fails:

$ phpunit
PHPUnit 10.0.19 by Sebastian Bergmann and contributors.

Test directory "/home/sneakyimp/ci3/tests/./codeigniter/core" not found

It would seem that there is a problem with the file tests/phpunit.xml, which specifies this path and a couple of others:

<?xml version="1.0" encoding="UTF-8"?>

<phpunit
	bootstrap="./Bootstrap.php"
	colors="true"
	convertNoticesToExceptions="true"
	convertWarningsToExceptions="true"
	stopOnError="false"
	stopOnFailure="false"
	stopOnIncomplete="false"
	stopOnSkipped="false"
	beStrictAboutTestsThatDoNotTestAnything="false">
	<testsuites>
		<testsuite name="CodeIgniter Core Test Suite">
			<directory suffix="test.php">./codeigniter/core</directory>
			<directory suffix="test.php">./codeigniter/helpers</directory>
			<directory suffix="test.php">./codeigniter/libraries</directory>
		</testsuite>
	</testsuites>
	<filter>
		<whitelist>
			<directory suffix=".php">../system/</directory>
		</whitelist>
	</filter>
</phpunit>

These paths appear wrong? There is no folder/directory in the CI3 codebase named codeigniter. If you replace /codeigniter/ with /mocks/ then phpunit will run, but complains there is no helpers subdir. removing that, phpunit will finally run, but complains about a deprecated schema, and runs no tests:

$ phpunit
PHPUnit 10.0.19 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.2.3
Configuration: /home/sneakyimp/ci3/tests/phpunit.xml

There was 1 PHPUnit warning:

1) Your XML configuration validates against a deprecated schema. Migrate your XML configuration using "--migrate-configuration"!

No tests executed!
@tenzap
Copy link
Contributor

tenzap commented Jun 18, 2023

AFAIK, phpunit 10 is not supported as of today.
You would have to migrate the configuration, but after this you will encounter other issues: See also #6219

Try with a previous version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants