Skip to content

Add static analysis and PHPUnit harness #8

Open

Description

@eleshar

Scope

PHPCS/WPCS is wired up, but there is no static analysis and no test harness in either repo. A scaffolded project therefore starts with no way to run a test, which means it never gets one.

Add to both ls-starter-plugin and ls-starter-theme:

  • PHPStan config at a realistic starting level with the WordPress stubs, so it passes clean on the scaffold and can be tightened per project.
  • A phpcs.xml.dist ruleset file rather than relying only on CLI flags in a Composer script — more portable and discoverable.
  • A PHPUnit setup with a wp-env (or equivalent) harness, plus one trivial passing test that proves the harness works.
  • Composer and npm scripts for each, wired into the existing code-quality workflow as separate jobs.

Keep the scaffold green: the point is a working harness that passes on an empty template, not a strict configuration that a new project must immediately fight.

Acceptance criteria

  • composer analyse (or equivalent) runs PHPStan clean on both scaffolds.
  • phpcs.xml.dist present in both repos and used by the existing PHPCS script.
  • composer test runs the PHPUnit suite against a wp-env install and the example test passes.
  • Both new checks run in the code-quality workflow on pull requests to develop and are green on the unmodified scaffold.
  • CI runtime increase is stated in the PR; the harness must not require credentials or network access beyond package installs.
  • README documents how to run analysis and tests locally.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:ciBuild and CI pipelineslang:phpPHP codepriority:normalDefault priority for most issues.status:needs-devAnything that needs development.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions