Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4 - load theme from arbitrary paths #727

Merged
merged 4 commits into from
May 24, 2024
Merged

Conversation

lucatume
Copy link
Owner

This PR continues the work done to support loading plugins from arbitrary absolute and relative paths to extend the same support to themes.

The WPLoader module will now allow specifying the theme to load in the theme parameter as:

  • a slug that will be searched for in the WordPress installation themes directories, e.g. twentytwentythree
  • a path relative to the project root directory, e.g. vendor/acme/some-theme
  • an absolute path, e.g. /home/themes/some-theme

Furthermore, the PR extends the same suport to parent and child themes allowing the theme configuration parameter to be an array:

actor: IntegrationTester
bootstrap: _bootstrap.php
modules:
  enabled:
    - \Helper\Integration
    - lucatume\WPBrowser\Module\WPLoader:
        wpRootFolder: '%WP_ROOT_FOLDER%'
        dbUrl: '%WP_DB_URL%'
        tablePrefix: '%WP_TABLE_PREFIX%'
        domain: '%WP_DOMAIN%'
        adminEmail: '%WP_ADMIN_EMAIL%'
        title: '%WP_TITLE%'
        plugins: []
        # Parent theme from the WordPress installation themes directory, child theme from absolute path.
        theme: [twentytwentythree, /home/themes/my-theme]

Relative paths include the . to indicate the current working directory:

actor: IntegrationTester
bootstrap: _bootstrap.php
modules:
  enabled:
    - \Helper\Integration
    - lucatume\WPBrowser\Module\WPLoader:
        wpRootFolder: /var/wordpress
        dbUrl: sqlite:///var/wordpress/wp-tests.sqlite
        dump:
          - tests/_data/products.sql
          - tests/_data/users.sql
          - tests/_data/orders.sql
        tablePrefix: test_
        domain: wordpress.test
        adminEmail: [email protected]
        title: 'Integration Tests'
        plugins: []
        theme: 
          # Parent theme from relative path.
          - vendor/acme/parent-theme
          # Child theme from the current working directory.
          - .

This is the second step of the work required to support really standalone development of themes and plugins without requiring specific directorye positioning.
The next step will be updating the setup procedure to avoid symbolically linking themes or plugins in place in the WordPress installation directory.

@lucatume lucatume self-assigned this May 23, 2024
@lucatume lucatume marked this pull request as ready for review May 24, 2024 07:49
@lucatume lucatume merged commit ed1ba9a into master May 24, 2024
43 checks passed
@lucatume lucatume deleted the v4-arbitrary-theme-path branch May 24, 2024 07:49
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