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

Prefix bug #7

Open
wants to merge 6 commits into
base: 2.x
Choose a base branch
from
Open

Prefix bug #7

wants to merge 6 commits into from

Conversation

Katalam
Copy link

@Katalam Katalam commented Oct 6, 2023

Basically what happend here pestphp/pest#966 was that the plugin created directories with the path Core/lication/Contracts instead of Core/Application/Contracts with the given code

test('app')
    ->expect('App\Core\Application\Contracts')
    ->toBeClasses();

And passed because no File was found

@Katalam
Copy link
Author

Katalam commented Oct 10, 2023

@devajmeireles The test problem does not sound like a problem on my side, can you have a look at it?

// This is needed to avoid having a prefix like "App" and a namespace like "App\Application\..."
// This would result in a directory like "\lication\..."
$posFirstPrefix = strpos($name, $prefix);
$nameWithoutPrefix = $posFirstPrefix !== false ? substr($name, $posFirstPrefix + strlen($prefix)) : $name;
Copy link
Member

Choose a reason for hiding this comment

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

Can you first create a test - that fails prior to this change?

Copy link
Author

Choose a reason for hiding this comment

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

Tbh I don't really know how to do it, the linked issue shows a problematic environment and I don't know how I create a test case that will use a logic that I overwrite within the same branch

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