Code Monkey home page Code Monkey logo

Comments (8)

lucatume avatar lucatume commented on June 3, 2024

First idea that comes to mind and the path of less resistance is to use the bootstrapActions parameter in WPLoader config to run the action in charge of creating the tables and to hook the table creation method to a test action.
E.g.

add_action( 'init', [ $tables, 'maybe_create_tables' ] );

// probably not in production code but in a tests config file
add_action( 'test_init_alias', [ $tables, 'maybe_create_tables' ] );

and in WPLoader configuration file:

bootstrapActions:
    - test_init_alias

Running the installation in a separate process is not an impossible task though and I might explore it but I'd like to try easier solutions first.

from wp-browser.

lucatume avatar lucatume commented on June 3, 2024

An update on this: I've pushed a first draft code to the https://github.com/lucatume/wp-browser/tree/enhance/separated-process-install branch.
For the time being it does little but replicate what the core testing suite does but that's a start.
Will iterate on this.

from wp-browser.

jbrinley avatar jbrinley commented on June 3, 2024

Yes, this works (almost).

I had to make one change in isolated-install.php. After the defines loop (lines 10-12), I added:

$table_prefix = WP_TESTS_TABLE_PREFIX;

Otherwise all the tables are created with no prefix.

from wp-browser.

lucatume avatar lucatume commented on June 3, 2024

Thanks for pointing it out; I've pushed a commit to the branch to fix that.

I've left the code in a branch as I've not yet taken the time to verify all the functionalities; what's that "almost" about?

from wp-browser.

jbrinley avatar jbrinley commented on June 3, 2024

what's that "almost" about?

Just the table prefix comment.

Also, I note that a custom WP_CONTENT_DIR doesn't carry through to the install. That's probably fine, but it does mean that custom tables created by plugins aren't deleted when the core tables are deleted. That works well for my purposes, but I'm not sure if it's a feature or a bug.

from wp-browser.

lucatume avatar lucatume commented on June 3, 2024

Ok, thanks.

I will look into the WP_CONTENT_DIR issue as the expected behaviour is to carry over (I guess).

from wp-browser.

lucatume avatar lucatume commented on June 3, 2024

Refreshing the issue: how is this going?

from wp-browser.

lucatume avatar lucatume commented on June 3, 2024

Closing the issue due to lack of activity, should this not be resolved I will re-open.

from wp-browser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.