Skip to content

Commit d934c01

Browse files
committed
fix tests
1 parent bdd69d1 commit d934c01

7 files changed

Lines changed: 40 additions & 135 deletions

File tree

.ddev/config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ additional_fqdns: []
99
database:
1010
type: mariadb
1111
version: "10.11"
12+
hooks:
13+
post-start:
14+
- exec-host: ddev mysql < .ddev/mysql/init_test_db.sql
1215
use_dns_when_possible: true
1316
composer_version: "2"
1417
web_environment: []

.ddev/mysql/init_test_db.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This file gets executed every time the db container gets started via ddev.
2+
# See .ddev/config.yaml for more details.
3+
DROP DATABASE IF EXISTS db_test;
4+
CREATE DATABASE db_test;
5+
GRANT ALL ON db_test.* TO 'db'@'%';
6+
FLUSH PRIVILEGES;

.github/workflows/ci.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ name: CI
33
on:
44
push:
55
branches:
6-
- '5.x'
7-
- '5.next'
8-
- '6.x'
6+
- 'master'
97
pull_request:
108
branches:
119
- '*'
@@ -21,8 +19,6 @@ jobs:
2119
fail-fast: false
2220
matrix:
2321
include:
24-
- php-version: '8.1'
25-
dependencies: 'lowest'
2622
- php-version: '8.4'
2723
dependencies: 'highest'
2824

@@ -52,7 +48,7 @@ jobs:
5248
DATABASE_TEST_URL: sqlite://./testdb.sqlite
5349

5450
coding-standard:
55-
name: Coding Standard & Static Analysis
51+
name: Coding Standard
5652
runs-on: ubuntu-24.04
5753

5854
steps:
@@ -61,19 +57,13 @@ jobs:
6157
- name: Setup PHP
6258
uses: shivammathur/setup-php@v2
6359
with:
64-
php-version: '8.1'
60+
php-version: '8.4'
6561
extensions: mbstring, intl
6662
coverage: none
67-
tools: cs2pr, phpstan:1.12
63+
tools: cs2pr
6864

6965
- name: Composer install
7066
uses: ramsey/composer-install@v3
7167

7268
- name: Run PHP CodeSniffer
7369
run: vendor/bin/phpcs --report=checkstyle | cs2pr
74-
75-
- name: Run phpstan
76-
if: always()
77-
run: phpstan
78-
env:
79-
SECURITY_SALT: f76f1c8475585c46c6acd3ddcb8f5e0f15de524637bb4080a08c4afe7cfc9144

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ ddev exec bin/cake clean
5555
If you want to start with a fresh DB, you can run the following command:
5656

5757
```bash
58-
ddev exec -s db mysql -uroot -proot -e "DROP DATABASE IF EXISTS db; CREATE DATABASE db;"
58+
ddev exec -s db mysql -uroot -proot -e "DROP DATABASE IF EXISTS db; CREATE DATABASE db; CREATE DATABASE testdb;"
5959
```
6060

6161
> [!NOTE]

tests/Fixture/PackagesFixture.php

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,28 @@ public function init(): void
2020
$this->records = [
2121
[
2222
'id' => 1,
23-
'package' => 'Lorem ipsum dolor sit amet',
24-
'description' => 'Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.',
25-
'repo_url' => 'Lorem ipsum dolor sit amet',
26-
'packagist_url' => 'Lorem ipsum dolor sit amet',
27-
'downloads' => 1,
28-
'stars' => 1,
23+
'package' => 'markstory/asset_compress',
24+
'description' => 'Featured package used to verify the homepage slider.',
25+
'repo_url' => 'https://github.com/markstory/asset_compress',
26+
'downloads' => 5000,
27+
'stars' => 450,
28+
'latest_stable_version' => '5.0.0',
2929
],
3030
];
31+
32+
for ($i = 2; $i <= 24; $i++) {
33+
$packageNumber = str_pad((string)($i - 1), 2, '0', STR_PAD_LEFT);
34+
$this->records[] = [
35+
'id' => $i,
36+
'package' => sprintf('vendor/package-%s', $packageNumber),
37+
'description' => sprintf('Test package %s for controller pagination and search coverage.', $packageNumber),
38+
'repo_url' => sprintf('https://github.com/vendor/package-%s', $packageNumber),
39+
'downloads' => 1000 - $i,
40+
'stars' => 100 - $i,
41+
'latest_stable_version' => sprintf('1.%d.0', $i - 2),
42+
];
43+
}
44+
3145
parent::init();
3246
}
3347
}

tests/TestCase/Controller/PagesControllerTest.php

Lines changed: 0 additions & 113 deletions
This file was deleted.

tests/bootstrap.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
// Connection aliasing needs to happen before migrations are run.
6161
// Otherwise, table objects inside migrations would use the default datasource
6262
ConnectionHelper::addTestAliases();
63+
ConnectionHelper::dropTables('test');
6364

6465
// Use migrations to build test database schema.
6566
//
@@ -72,4 +73,8 @@
7273
// use Cake\TestSuite\Fixture\SchemaLoader;
7374
// (new SchemaLoader())->loadSqlFiles('./tests/schema.sql', 'test');
7475

75-
(new Migrator())->run();
76+
(new Migrator())->runMany([
77+
[],
78+
['plugin' => 'Tags'],
79+
['plugin' => 'ADmad/SocialAuth'],
80+
]);

0 commit comments

Comments
 (0)