Skip to content

Commit 919704c

Browse files
[doctrine/doctrine-bundle] Use dbname_suffix in tests
1 parent daf1443 commit 919704c

File tree

8 files changed

+98
-13
lines changed

8 files changed

+98
-13
lines changed

doctrine/doctrine-bundle/2.3/config/packages/doctrine.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
doctrine:
22
dbal:
3-
override_url: true
3+
# IMPORTANT: DATABASE_URL *must* define the server version
44
url: '%env(resolve:DATABASE_URL)%'
5-
6-
# IMPORTANT: You MUST configure your server version,
7-
# either here or in the DATABASE_URL env var (see .env file)
8-
#server_version: '13'
95
orm:
106
auto_generate_proxy_classes: true
117
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
#doctrine:
2-
# dbal:
3-
# # Overrides the database name in the test environment only
4-
# # "host", "port", "user", & "password" can also be set to override their respective url parts
5-
# #
6-
# # If you're using ParaTest, "TEST_TOKEN" is set by ParaTest otherwise nothing is appended to the database name.
7-
# dbname: main_test%env(default::TEST_TOKEN)%
1+
doctrine:
2+
dbal:
3+
# "TEST_TOKEN" is typically set by ParaTest
4+
dbname: 'main_test%env(default::TEST_TOKEN)%'

doctrine/doctrine-bundle/2.3/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"env": {
1010
"#1": "Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url",
11-
"#2": "IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml",
11+
"#2": "IMPORTANT: DATABASE_URL *must* define the server version",
1212
"#3": "",
1313
"#4": "DATABASE_URL=\"sqlite:///%kernel.project_dir%/var/data.db\"",
1414
"#5": "DATABASE_URL=\"mysql://db_user:[email protected]:3306/db_name?serverVersion=5.7\"",
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
doctrine:
2+
dbal:
3+
# IMPORTANT: DATABASE_URL *must* define the server version
4+
url: '%env(resolve:DATABASE_URL)%'
5+
orm:
6+
auto_generate_proxy_classes: true
7+
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
8+
auto_mapping: true
9+
mappings:
10+
App:
11+
is_bundle: false
12+
type: annotation
13+
dir: '%kernel.project_dir%/src/Entity'
14+
prefix: 'App\Entity'
15+
alias: App
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
doctrine:
2+
orm:
3+
auto_generate_proxy_classes: false
4+
metadata_cache_driver:
5+
type: pool
6+
pool: doctrine.system_cache_pool
7+
query_cache_driver:
8+
type: pool
9+
pool: doctrine.system_cache_pool
10+
result_cache_driver:
11+
type: pool
12+
pool: doctrine.result_cache_pool
13+
14+
framework:
15+
cache:
16+
pools:
17+
doctrine.result_cache_pool:
18+
adapter: cache.app
19+
doctrine.system_cache_pool:
20+
adapter: cache.system
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
doctrine:
2+
dbal:
3+
# "TEST_TOKEN" is typically set by ParaTest
4+
dbname_suffix: '_test%env(default::TEST_TOKEN)%'
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"bundles": {
3+
"Doctrine\\Bundle\\DoctrineBundle\\DoctrineBundle": ["all"]
4+
},
5+
"copy-from-recipe": {
6+
"config/": "%CONFIG_DIR%/",
7+
"src/": "%SRC_DIR%/"
8+
},
9+
"env": {
10+
"#1": "Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url",
11+
"#2": "IMPORTANT: DATABASE_URL *must* define the server version",
12+
"#3": "",
13+
"#4": "DATABASE_URL=\"sqlite:///%kernel.project_dir%/var/data.db\"",
14+
"#5": "DATABASE_URL=\"mysql://db_user:[email protected]:3306/db_name?serverVersion=5.7\"",
15+
"DATABASE_URL": "postgresql://db_user:[email protected]:5432/db_name?serverVersion=13&charset=utf8"
16+
},
17+
"dockerfile": [
18+
"RUN apk add --no-cache --virtual .pgsql-deps postgresql-dev; \\",
19+
"\tdocker-php-ext-install -j$(nproc) pdo_pgsql; \\",
20+
"\tapk add --no-cache --virtual .pgsql-rundeps so:libpq.so.5; \\",
21+
"\tapk del .pgsql-deps"
22+
],
23+
"docker-compose": {
24+
"docker-compose.yml": {
25+
"services": [
26+
"database:",
27+
" image: postgres:${POSTGRES_VERSION:-13}-alpine",
28+
" environment:",
29+
" POSTGRES_DB: ${POSTGRES_DB:-app}",
30+
" # You should definitely change the password in production",
31+
" POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-ChangeMe}",
32+
" POSTGRES_USER: ${POSTGRES_USER:-symfony}",
33+
" volumes:",
34+
" - db-data:/var/lib/postgresql/data:rw",
35+
" # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!",
36+
" # - ./docker/db/data:/var/lib/postgresql/data:rw"
37+
],
38+
"volumes": ["db-data:"]
39+
},
40+
"docker-compose.override.yml": {
41+
"services": [
42+
"database:",
43+
" ports:",
44+
" - \"5432\""
45+
]
46+
}
47+
}
48+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<bg=blue;fg=white> </>
2+
<bg=blue;fg=white> Database Configuration </>
3+
<bg=blue;fg=white> </>
4+
5+
* Modify your DATABASE_URL config in <fg=green>.env</>

0 commit comments

Comments
 (0)