0
votes

When I run my acceptance test, I get the error below. If I don't have anything in the dump.sql, then the test runs. Inside the test, I am able to reach the database. The database creds are identical in the two files below. Am I right that the dump.sql load uses the acceptance.suite.yml (because I misnamed dump.sql on purpose in acceptance.suite.yml and then codeception.yml and it looks like the dump.sql uses the settings in acceptance.suite.yml)? Am I right that the test steps use PDO which use codecepiton.yml? If they are the same, then why do I get the access violation?

acceptance.suite.yml

class_name: AcceptanceTester
modules:
enabled:
    - PhpBrowser
    - AcceptanceHelper
    - Db
config:
    PhpBrowser:
        url: 'https://site.com'
    Db:
        dsn: 'mysql:host=xxx;dbname=xxx'
        user: 'xxx'
        password: 'xxx'
        dump: 'tests/_data/dump.sql'
        populate: 'true'
        cleanup: 'true'

codeception.yml

actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
helpers: tests/_support
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
modules:
enabled: [PhpBrowser,Db]
config:
    Db:
        dsn: 'mysql:host=xxx;dbname=xxx'
        user: 'xxx'
        password: 'xxx'
        dump: 'test/_data/dump.sql'
        populate: 'true'
        cleanup: 'true'

dump.sql CREATE TABLE xxx ... <

Error:
[Codeception\Exception\Module] (Exception in Db) SQLSTATE[42000]: Syntax error or access violation: 1064 Y ou have an error in your SQL syntax; check the manual that corresponds to y our MySQL server version for the right syntax to use near 'CREATE TABLE `f

1

1 Answers

0
votes
  CREATE TABLE

Looks like these extraneous characters are being prepended to your CREATE TABLE statement. Get rid of those and you should be good to go ...