phpmd / phpmd/phpmd

Improve on testing classes as a lib

Open
#247 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement On Hold
Dominant language
PHP
Stars
2.5k
Forks
361
Avg merge
1d 19h
Merged PRs (30d)
11

Description

I have my own set of rules in a personal repository. Via composer, vendor/bin/phpmd picks them up seamlessly which is really cool!

However, I've started toying with the idea of testing my rules by extending AbstractTest and have run into a few problems. The main problem seems to be that AbstractTest is not very flexible. Specifically, createResourceUriForTest makes a lot of assumptions as to where the resources files are.

Is there a way to point the tests at some other resource file directory in my repo? Instead of having that method assume that all file resources are in vendor/phpmd/phpmd/src/test/resources/files/<PATH_TO_RULES>?

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 by reading src/test/php/PHPMD/AbstractTest.php, especially createResourceUriForTest and its assumptions about src/test/resources/files. Determine how an external repository could provide a different resource directory, then verify that tests extending AbstractTest can use custom rule resources outside the vendor path.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
testing, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.