Closed mcube27 closed 2 years ago
When I use WAMP on my computer, everything works like a charm. it's only with the docker setup.
@mcube27 if I get you well, you also get an error when running on docker locally, right?
The error reported Base table or view not found: 1146 Table 'mcube27_jmstest.users' doesn't exist
suggest that your database in named mcube27_jmstest
while on your docker command, the database is test
. Could this be due to some configuration of your Datasources?
For info, the pipelines of the fixture factories run with the test suite light, as shown here. The test suite light should trigger issues on docker.
Hi,
Yes locally on docker.
I change the name of the database for the docker line in this issue report. I used the mcube27_jmstest for my tests.
I did not understand what you said about test suite light triggering issues on docker ?
Which version of CakePHP are you using? How do you create the schema of your test DB? Do you use the Migrator? How does your phpunit.xml look like?
I use Cakephp 4.2.10
I use the fields in the fixtures. I have issues with the Migrator on going and can't use it without it triggering errors.
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
colors="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="./tests/bootstrap.php"
>
<php>
<ini name="memory_limit" value="-1"/>
<ini name="apc.enable_cli" value="1"/>
</php>
<!-- Add any additional test suites you want to run here -->
<testsuites>
<testsuite name="App Test Suite">
<directory>./tests/TestCase</directory>
</testsuite>
<!--<testsuite name="pipeline">
<directory>./tests/TestCase/UnitTests/SendinBlueTransportUnitTest.php</directory>
</testsuite>-->
<!-- Add plugin test suites here. -->
</testsuites>
<!-- Setup a listener for fixtures -->
<listeners>
<listener class="CakephpTestSuiteLight\FixtureInjector">
<arguments>
<object class="CakephpTestSuiteLight\FixtureManager" />
</arguments>
</listener>
</listeners>
<!-- Ignore vendor tests in code coverage reports -->
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
<directory suffix=".php">plugins/*/src/</directory>
<exclude>
<file>src/Console/Installer.php</file>
</exclude>
</whitelist>
</filter>
<logging>
<log type="testdox-text" target="php://stdout"/>
</logging>
</phpunit>
Thanks for the additional input.
I am not sure on how the test suite light reacts with the schema creation using the fields in the fixtures. There should be no problem, but I am a bit out of time right now to investigate.
How do you manage your productive database? With migrations? If So, I would suggest fixing the issues you are having with the migrator, since this is anyway from CakePHP 4.3 the recommended approach. I can assist you there if needed. What were the issues you encountered?
I understand. I can use it like this as it works with the standard Cakephp listeners for phpuni
I have an open issue for the migrator : https://github.com/cakephp/cakephp/issues/16373
The issue you cite is not related to the Migrator. I would suggest using Vierge Noire's Migrator to manage the schema of your test DB.
Once in CakePHP 4.3, you can switch to the CakePHP Migrator tool.
I prefer to wait that my issues to switch to cakephp 4.3 are resolved.
I have another issue with the migrator but wait on this one.
Thanks !
Issues are always welcome, so if you ever want to report the one you had on the migrator here, feel free to do so here.
Hi,
I use Cakephp 4.2.10 and "vierge-noire/cakephp-fixture-factories": "2.5"
I am using Bibucket pipelines with docker images to perform tests.
When I want to do my tests using a docker image for the database, it does not work with the php unit listeners of CakephpTestSuiteLight.
I get this :
And I get this cli_error message :
But it works if I reverse back to cakephp normal listener.
I ran it on my computer with docker using this to start the database server
docker run --name mariadblatest --env MARIADB_ROOT_PASSWORD=secret --env MARIADB_USER=dev --env MARIADB_DATABASE=test --env MARIADB_PASSWORD=test -p 3306:3306 mariadb:latest
I have been searching for 2 hours but I do not understand. Maybe the triggers are not set on the database ?
Thank you very much !