neos / neos/BuildEssentials

UnitTestBootstrap.php Not working with psr-4

Open
#35 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
9
Forks
10
PR merge metrics
No merged PRs in 30d

Description

UnitTestBootstrap.php does not seem to be working with psr-4 since Flow 4 (I think).

The problem seems to be on line 55

$classesOrTests = ($classNameParts[$index + 1] === 'Tests' && isset($classNameParts[$index + 2]) && $classNameParts[$index + 2] === 'Unit') ? '/' : '/Classes/' . implode('/', $packageKeyParts) . '/';

which results in /Classes/PackagePart1/PackagePart2 being appended to PackagePart1.PackagePart2 and then can't load php class file as it doesn't exist.

If you amend line 55 to below - it seems to work
$classesOrTests = ($classNameParts[$index + 1] === 'Tests' && isset($classNameParts[$index + 2]) && $classNameParts[$index + 2] === 'Unit') ? '/' : '/Classes/';

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in UnitTestBootstrap.php at line 55 and compare the current path construction with the reported PSR-4 package layout. Verify that the duplicated /Classes/PackagePart1/PackagePart2 segment is not added and that the unit-test bootstrap can load the affected PHP class.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.