Giter Site home page Giter Site logo

HTTP Testing of Plugin not possible about winter HOT 4 OPEN

der-On avatar der-On commented on July 18, 2024
HTTP Testing of Plugin not possible

from winter.

Comments (4)

bennothommo avatar bennothommo commented on July 18, 2024

@der-On this would be related to 71fcf8e, which itself is related to an issue reporting in October years ago.

Essentially, we had to disable the plugin register() method and routes.php and init.php files within plugins when running CLI commands (such as winter:test) if the database is either unavailable or hasn't yet been configured/migrated, as multiple people would run commands for environments such as Vapor without the database being made available yet and would encounter exceptions if a plugin used a database during registration.

Personally, I'm not a fan of the fix - I think plugin developers should be more responsible and not be calling the database during registration, but I digress, since it was reported commonly enough, we had to err on the side of caution.

One thing you could do - I don't know how difficult it would be with your setup - but you could run the migrations before the tests run. If the database is available and migrated before the tests are run, you would side-step this fix.

Alternatively, we could make it so that this fix is applied conditionally (enabled by default) and could be disabled by an option to the winter:test command, but I'm not a massive fan of that either.

from winter.

der-On avatar der-On commented on July 18, 2024

@bennothommo I'm already running the tests after the database is migrated. This is actually part of the PluginTestCase setUp method by default.

from winter.

bennothommo avatar bennothommo commented on July 18, 2024

@der-On have the migrations been run on the test database before you run the tests?

The reason I ask is because the function that disables plugin initialization (here in the code) specifically looks for whether the migration table is set up, as winter:test itself is not a privileged CLI command. In your unit tests, you would likely be using a different database connection.

from winter.

der-On avatar der-On commented on July 18, 2024

@bennothommo As far as I can tell, It uses the test database. I however did create a config/testing/database.php.

from winter.

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.