0
votes

i'm trying to connect to my db in codeception. provided following configurations in my api.suite.dist.yml and codeception.dist.yml file (i didn't know where to provide configurations so i provide in both api.suite.dist.yml and codeception.dist.yml)

here is my api.dist.suite.yml

class_name: ApiTester
modules:
enabled:
- PhpBrowser:
url: http://192.168.1.143
- REST:
depends: PhpBrowser
url: https://dev-tv.dna.fi/api/user/guest/epg
- \Helper\Api
- Db:
dsn: 'mysql:host=127.0.0.1;dbname=db'
user: 'username'
password: 'passsword'

and here is my codeception.dist.yml

actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
extensions:
enabled:
- Codeception\Extension\RunFailed
modules:
config:
Db:
dsn: 'mysql:host=127.0.0.1;dbname=db'
user: 'username'
password: 'password'

and this is the response i get

[Codeception\Exception\ModuleException]

Db: SQLSTATE[28000] [1045] Access denied for user 'webapiuser'@'localhost' (using password: YES) while creating PDO connection

run [-c|--config CONFIG] [--report] [--html [HTML]] [--xml [XML]] [--tap [TAP]] [--json [JSON]] [--colors] [--no-colors] [--silent] [--steps] [-d|--debug] [--coverage [COVERAGE]] [--coverage-html [COVERAGE-HTML]] [--coverage-xml [COVERAGE-XML]] [--coverage-text [COVERAGE-TEXT]] [--no-exit] [-g|--group GROUP] [-s|--skip SKIP] [-x|--skip-group SKIP-GROUP] [--env ENV] [-f|--fail-fast] [--no-rebuild] [--] [] []

1

1 Answers

0
votes
  1. Don't use codeception.yml. Configuration in api.suite.yml is enough.
  2. Make sure you use right credentials.

My acceptance.suite.yml

class_name: WebGuy
modules:
  enabled:
    - Db
  config:
      Db:
        dsn: mysql:host=127.0.0.1;dbname=mydbname
        user: myuser
        password: mypass
        populate: false
        cleanup: false