Integration testing my implementation against Aimeos
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Integration testing my implementation against Aimeos
I want to write integration & functional tests of my TYPO3/Aimeos extension against Aimeos components. That's especially important since we're using dev-master versions of Aimeos
My components need to also instantiate the Aimeos Context, including locales. The code looks like this:
This fails:
That's understandable, since Typo3 knows nothing of Aimeos' tables (see this longstanding issue) and the testing framework doesn't instantiate them. I will also need the product, attribute, etc. tables later on, so this is just the first error.
So, my question is: how do I test my components in this scenario? I can think of two ways:
Thanks!
PHP Version: 7.1, Aimeos: recent dev-master, Typo3 8.7.8, and TYPO3/testing-framework 2.0.1, Linux, (dockerised Debian)
My components need to also instantiate the Aimeos Context, including locales. The code looks like this:
Code: Select all
$aimeosSettings = Aimeos\Base::getConfig($settings ?? []);
$this->_context = Aimeos\Base::getContext($aimeosSettings);
$locale = Aimeos\Base::getLocaleBackend($this->_context, $site ?? 'default');
$this->_context->setLocale($locale);
Code: Select all
Aimeos\MW\DB\Exception: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'testdb_ftfadd314.mshop_locale_site' doesn't exist
So, my question is: how do I test my components in this scenario? I can think of two ways:
- a) run the aimeos extension update script in `setUp()` — but I don't yet know how.
- b) prepare the tables using a fixture, or, if that is not possible, directly using doctrine DBAL to create the tables.
- c) Mock the Aimeos context in some way that doesn't ruin the integration/functional nature of my tests. That would be my least preferred option.
Thanks!
PHP Version: 7.1, Aimeos: recent dev-master, Typo3 8.7.8, and TYPO3/testing-framework 2.0.1, Linux, (dockerised Debian)
Re: Integration testing my implementation against Aimeos
Creating the tables should be rather simple by using the setup method (https://github.com/aimeos/aimeos-typo3/ ... /Setup.php):
BTW: What was the reason for using dev-master?
Code: Select all
\Aimeos\Aimeos\Setup::execute();
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Integration testing my implementation against Aimeos
Thanks for your answer So it's basically running the Aimeos Update script, I can live with that (even though it makes the test very slow.)
It seems it can't find the static_countries table during the call to Setup::execute(), and hence some SQL fails. I'll see if I can find that table somewhere and just add it as a fixture or directly over Doctrine.
We're using dev-master because we were initially relying on the (bug-free implementation) of some newer additions to Aimeos, such as JQAdm and the JSON API. Our project is in active development, and we're going to cut to a stable release as soon as the project nears completion. In the meantime, we can test bleeding edge Aimeos and send you bug reports
It seems it can't find the static_countries table during the call to Setup::execute(), and hence some SQL fails. I'll see if I can find that table somewhere and just add it as a fixture or directly over Doctrine.
We're using dev-master because we were initially relying on the (bug-free implementation) of some newer additions to Aimeos, such as JQAdm and the JSON API. Our project is in active development, and we're going to cut to a stable release as soon as the project nears completion. In the meantime, we can test bleeding edge Aimeos and send you bug reports
Re: Integration testing my implementation against Aimeos
Put the method call into the setUpBeforeClass() of your test classes. Then, the tables will be checked only once for eachaleks wrote:Thanks for your answer So it's basically running the Aimeos Update script, I can live with that (even though it makes the test very slow.)
test class.
Yes, the static_countries tables are not part of Aimeos but of the static_info_tables extension.aleks wrote:It seems it can't find the static_countries table during the call to Setup::execute(), and hence some SQL fails. I'll see if I can find that table somewhere and just add it as a fixture or directly over Doctrine.
Always very welcome!aleks wrote:We're using dev-master because we were initially relying on the (bug-free implementation) of some newer additions to Aimeos, such as JQAdm and the JSON API. Our project is in active development, and we're going to cut to a stable release as soon as the project nears completion. In the meantime, we can test bleeding edge Aimeos and send you bug reports
According to our todo list, the PHP changes are almost done besides renaming all templates for consistency (default -> standard). The most active development is currently in the JQAdm interface (using Vue.js in templates) so please expect a few problems there from time to time ...
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star