Skip to content

Move production files under src/ directory - #44

Merged
remyperona merged 1 commit into
developfrom
reorganize-src-directory
Aug 14, 2026
Merged

Move production files under src/ directory#44
remyperona merged 1 commit into
developfrom
reorganize-src-directory

Conversation

@remyperona

Copy link
Copy Markdown
Contributor

What

Reorganize the library's production code under a dedicated src/ directory to clearly separate shipped code from the package's own test suite (Tests/), tooling (bin/, wpmedia-phpunit), and configuration.

src/
├── ArrayTrait.php
├── BootstrapManager.php
├── TestCaseTrait.php
├── VirtualFilesystemDirect.php
├── VirtualFilesystemTestTrait.php
├── bootstrap-functions.php
├── Fixtures/polyfills.php
├── Integration/   (TestCase, traits, bootstrap.php, phpunit.xml.dist, …)
└── Unit/          (TestCase, bootstrap.php, phpunit.xml.dist, …)

Tests/, bin/, wpmedia-phpunit, and root config/dotfiles are unchanged in location.

Config updated to follow the move

  • composer.json — PSR-4 WPMedia\PHPUnit\ now maps to src/; added an autoload-dev mapping WPMedia\PHPUnit\Tests\ → Tests/ so the self-tests still autoload.
  • wpmedia-phpunit — requires src/BootstrapManager.php.
  • BootstrapManager__DIR__-relative lookups (consumer's vendor/bin/phpunit and root dir) each gained one dirname() for the extra directory level.
  • src/{Unit,Integration}/phpunit.xml.dist — relative Tests/ paths bumped by one level.
  • Tests/{Unit,Integration}/init-tests.php — require the bootstrap from src/.

Public namespaces are unchanged, so consumers extending WPMedia\PHPUnit\Integration\TestCase / WPMedia\PHPUnit\Unit\TestCase are unaffected. CI workflows and README needed no changes.

Testing

  • Every move is a clean git rename.
  • composer test-unitOK (91 tests, 282 assertions), matching the pre-change baseline.
  • php -l clean on all touched files; autoloader regenerates to the new paths.

🤖 Generated with Claude Code

@remyperona remyperona self-assigned this Aug 14, 2026
Reorganize the library's production code (autoloaded classes, traits,
bootstrap helpers, and the built-in Unit/Integration/Fixtures) under a
dedicated `src/` directory to clearly separate shipped code from the
package's own test suite, tooling, and configuration.

Updated configuration and path references to follow the move:
- composer.json: PSR-4 `WPMedia\PHPUnit\` now maps to `src/`; added an
  autoload-dev PSR-4 mapping for the `WPMedia\PHPUnit\Tests\` namespace.
- wpmedia-phpunit: require `src/BootstrapManager.php`.
- BootstrapManager: adjust __DIR__-based resolution of the consumer's
  vendor/bin/phpunit and root directory for the extra directory level.
- src/{Unit,Integration}/phpunit.xml.dist: bump the relative Tests paths
  by one level.
- Tests/{Unit,Integration}/init-tests.php: require the bootstrap from
  `src/`.
- phpstan.neon.dist / phpstan-baseline.neon / phpcs.xml.dist: point the
  analyzed paths at `src/`.

Verified: unit suite (95 tests, 297 assertions), PHPCS and PHPStan all pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@remyperona
remyperona force-pushed the reorganize-src-directory branch from b764798 to 1c150e6 Compare August 14, 2026 16:12
@remyperona
remyperona merged commit e3cd6b3 into develop Aug 14, 2026
9 checks passed
@remyperona
remyperona deleted the reorganize-src-directory branch August 14, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant