Skip to content

Namespacing Prado Tests, Unit Tests, and Test Harness Classes in dev with Prado\Test\Unit\ - #1271

Merged
ctrlaltca merged 4 commits into
pradosoft:masterfrom
belisoful:test-dev-namespace
Sep 17, 2026
Merged

ctrlaltca merged 4 commits into
pradosoft:masterfrom
belisoful:test-dev-namespace

Conversation

@belisoful

Copy link
Copy Markdown
Member

This puts the Prado Tests, Unit Tests, Test Harness Classes into namespaces on dev repos.

It makes some folder names PascalCase.
Break out combined class in files into their own files.

The PSR-4 test namespace commit recorded four renamed directories with
their old lowercase names. macOS resolves them regardless of case, but
Linux CI cannot autoload the classes inside them.

- tests/unit/Data/ActiveRecord/records -> Records
- tests/unit/Data/SqlMap/domain        -> Domain
- tests/unit/IO/HttpClient/fixtures    -> Fixtures
- tests/unit/PHPStan/fixtures          -> Fixtures
@belisoful

belisoful commented Sep 17, 2026 •

Copy link
Copy Markdown
Member Author

Waiting on pradosoft/prado-wsdlgenerator#5. This PR will basically require a few lines of change to all WIP Testing classes.

It's a good thing we're doing this too. Finding bugs.

Edit: ok... continuing.

- Blogs record declares TABLE = 'blogs'; without it ActiveRecord uses
  the fully qualified class name as the table name.
- TSoapServerTest serves its provider under a global alias; the WSDL
  generator writes the provider name into the namespace URI, and a
  namespaced name carries backslashes, which a URI cannot hold.
@belisoful
belisoful marked this pull request as ready for review September 17, 2026 08:57
@belisoful

Copy link
Copy Markdown
Member Author

@ctrlaltca Now that the WSDL gen repo is fixed for namespaces providers. this is a go. All new test classes need namespaces and so all WIP is affected. I never like pushing changes like this in the short term, knowing its needed for the long term.

@ctrlaltca
ctrlaltca merged commit 0e05f26 into pradosoft:master Sep 17, 2026
19 checks passed
@belisoful
belisoful deleted the test-dev-namespace branch September 17, 2026 21:39
belisoful pushed a commit to belisoful/prado that referenced this pull request Sep 26, 2026
…SubProperties, namespaced tests

Updates the REST service files after rebasing onto master so they match
the APIs and conventions master adopted since the branch point.

Framework:
- TRestService::run() logs through Prado\Util\Log\TLogger; the previous
  Prado\Util\TLogger reference fatals since the logging move (pradosoft#1258).
- CORS, Allow, and Vary headers use THttpHeaderName constants, and JSON
  responses and body detection use TMediaType::JSON (pradosoft#1161).
- TRestService::createResource() applies resource properties with
  setSubProperties() (pradosoft#1283).

Tests (pradosoft#1271 conventions):
- REST unit tests use the Prado\Test\Unit\Web\Services namespace.
- DoStyleResource moves to its own file; the fixtures and inline XML
  reference it by fully qualified class name.
- Private access uses PradoUnit::getProp/setProp/invoke, and globals are
  reset with PradoUnit::restoreInitialState(). The request's cached
  PATH_INFO is snapshotted and restored so it no longer leaks between tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants