Giter VIP home page Giter VIP logo

Comments (9)

davist11 avatar davist11 commented on August 17, 2024

👋

Any potential update here? Been holding off merging this plugin in. Thanks!

from craft-avatax.

imagehat avatar imagehat commented on August 17, 2024

@davist11 - Admittedly I haven't done a deep dive into Craft's testing, but are there any particular errors you're getting that may help track it down?

I'm hesitant to move up the console request check because I think we'd still want to install the Tax Category and override Fields if you're installing the plugin from the console. That check is just to prevent the CP redirect if running in the console.

Are you defining CRAFT_TESTS_PATH in tests/_bootstrap.php? One thought I had was to check for that constant to see if it's running in test mode and then just return. I'm not sure if there's a better way but that might be an easy one to try.

from craft-avatax.

davist11 avatar davist11 commented on August 17, 2024

There isn't really a great error to send you down a path because I just get a generic:

In Schema.php line 678:
                                                                               
  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'client_test.<nil>_n  
  avigation_navs' doesn't exist                                                
  The SQL being executed was: SELECT *                                         
  FROM `<nil>_navigation_navs`                                                 
  WHERE `<nil>_navigation_navs`.`dateDeleted` IS NULL                          
  ORDER BY `sortOrder`                                                         
                                                                               

In Command.php line 1299:
                                                                               
  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'client_test.<nil>_n  
  avigation_navs' doesn't exist   

Something in that onAfterInstall() method is preventing other plugins from being installed, but I'm not sure exactly which part. I can dig in and start doing more debugging if that's helpful to find out exactly where it's halting the installation of other plugins.

Are you defining CRAFT_TESTS_PATH in tests/_bootstrap.php

Yep, we have all these constants set in our bootstrap:

define('CRAFT_TESTS_PATH', __DIR__);
define('CRAFT_STORAGE_PATH', __DIR__ . '/_craft/storage');
define('CRAFT_TEMPLATES_PATH', __DIR__ . '/_craft/templates');
define('CRAFT_CONFIG_PATH', __DIR__ . '/_craft/config');
define('CRAFT_MIGRATIONS_PATH', __DIR__ . '/_craft/migrations');
define('CRAFT_TRANSLATIONS_PATH', __DIR__ . '/_craft/translations');
define('CRAFT_VENDOR_PATH', dirname(__DIR__) . '/vendor');

Maybe a FR for Craft would be to have some sort of boolean for when the test suite is running. Another option would be checking to see if the environment == test?

from craft-avatax.

imagehat avatar imagehat commented on August 17, 2024

I see. So it's breaking the next plugin install and maybe causes an error because the Navigation plugin didn't run it's migrations or something.

I wasn't sure if the environment was alway set to test when testing but if that's the case maybe we try adding something like:

if (Craft::$app->config->env === 'test') {
  return;
}

... at the top of this function to just bail:

craft-avatax/src/Avatax.php

Lines 199 to 204 in 67c93a8

/**
* Raised after the plugin is installed.
* Create the AvaTax Tax category and product fields.
*/
public function onAfterInstall()
{

from craft-avatax.

davist11 avatar davist11 commented on August 17, 2024

I think so, you can see in the test setup that is sets a default env value of test

https://github.com/craftcms/cms/blob/develop/src/test/TestSetup.php#L262-L281

And yeah, I think adding a check like that makes sense. Want me to manually add it and test? Would be happy to submit a PR.

from craft-avatax.

imagehat avatar imagehat commented on August 17, 2024

Good deal. Yeah if you can test it that would be awesome. Either a PR and I'll merge it or just let me know if the conditional works and I can get it added in and bump the version.

from craft-avatax.

davist11 avatar davist11 commented on August 17, 2024

Success, test suite passes! #38

from craft-avatax.

imagehat avatar imagehat commented on August 17, 2024

Thanks @davist11! Merged and version bumped.

from craft-avatax.

davist11 avatar davist11 commented on August 17, 2024

Awesome, thank you!

from craft-avatax.

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.