Skip to content

Added ability to request db versio, table engines + group requirements with 'one_of' condition#380

Open
SergeR wants to merge 3 commits into
webasyst:devfrom
SergeR:db-requirements
Open

Added ability to request db versio, table engines + group requirements with 'one_of' condition#380
SergeR wants to merge 3 commits into
webasyst:devfrom
SergeR:db-requirements

Conversation

@SergeR

@SergeR SergeR commented Oct 15, 2024

Copy link
Copy Markdown
Contributor

Database requirements:

[
  'db' => ['server'=>'MySQL, MariaDB', 'engine'=>'InnoDB'],
  'db.mysql' => ['version' => '>=5.6.4'],
  ['db.mariadb', ['version' => '>=10']
]

Group requirements

Testing is passed if at least one requirement item is passed testing

[
  [
    ['php', 'version' => '>=7.4'],
    ['php', 'version' => '<8.1']
  ],

  'one_of' => [
    'db.mysql' => ['version' => '>=8'],
    'db.mariadb' => ['version' => '>=10.1']
  ]
]

@SergeR

SergeR commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

I put together a small PHPUnit suite covering testDb() and the new one_of grouping (pass-if-any-alternative, fail-if-all-fail, short-circuit on first pass). It's not part of this PR's diff since the framework has no official test setup - shared as a gist instead, meant purely as a way to verify the behavior locally, not a proposal to add PHPUnit/Composer to the repo:

https://gist.github.com/SergeR/8b76904f47b72c91f519e571e372b39d

The gist's README has full install/run instructions; short version:

  1. Drop the files into a local tests/ folder at the repo root (layout is in the README).
  2. cd tests/vendors/phpunit && ./download.sh - fetches a gitignored phpunit-9.phar, nothing committed.
  3. php tests/vendors/phpunit/phpunit.phar -c tests/phpunit.xml runs the non-DB tests (8 tests, no setup needed).
  4. DB-dependent tests (testDb, one_of across DB servers) are excluded by default; run them with --group db after pointing wa-config/db.php at a throwaway database.

Happy to adjust the test cases if there's a preferred format/location for tests in this repo going forward.

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.

1 participant