Skip to content

Commit

Permalink
stash commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mringler committed Sep 29, 2023
1 parent 4f36eea commit 0f45479
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 106 deletions.
107 changes: 4 additions & 103 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,9 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: [ '7.4', '8.2' ]
db-type: [ sqlite, mysql, pgsql, agnostic ]
symfony-version: [ '4-min', '4-max', '5-min', '5-max', '6-min', '6-max' ]
exclude:
- symfony-version: '4-min'
php-version: '8.2'
- symfony-version: '6-min'
php-version: '7.4'
- symfony-version: '6-max'
php-version: '7.4'
php-version: [ '8.2' ]
db-type: [ pgsql ]
symfony-version: [ '6-max' ]
env:
DB_NAME: 'propel_tests'
DB_USER: 'propel'
Expand All @@ -46,19 +39,6 @@ jobs:
postgresql user: $DB_USER
postgresql password: $DB_PW

- name: Install MySQL latest
if: matrix.db-type == 'mysql' && matrix.php-version != '7.4'
uses: mirromutth/mysql-action@v1.1
with:
mysql root password: $DB_PW

- name: Install MariaDb min
if: matrix.db-type == 'mysql' && matrix.php-version == '7.4'
uses: getong/mariadb-action@v1.1
with:
mariadb version: '10.2'
mysql root password: $DB_PW

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
Expand Down Expand Up @@ -86,90 +66,11 @@ jobs:
- name: Composer install (Symfony version ${{ matrix.symfony-version }})
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Wait for MySQL server to load
if: matrix.db-type == 'mysql'
run: |
bash -c "
for i in {1..10}; do
mysqladmin -h 127.0.0.1 -u root status >/dev/null 2>&1 && exit 0 || sleep 6
echo 'trying again'
done;
echo 'could not establish connection after 10 tries'
exit 1
"
env:
MYSQL_PWD: ${{ env.DB_PW }}

- name: Create MySQL Propel user
if: matrix.db-type == 'mysql'
run: |
mysql -h 127.0.0.1 -u root -e "
CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PW';
CREATE USER '$DB_USER'@'%' IDENTIFIED BY '$DB_PW';
GRANT ALL PRIVILEGES ON *.* TO '$DB_USER'@'localhost';
GRANT ALL PRIVILEGES ON *.* TO '$DB_USER'@'%';
FLUSH PRIVILEGES;
"
env:
MYSQL_PWD: ${{ env.DB_PW }}

- name: Setup database for test suite
if: matrix.db-type != 'agnostic'
run: tests/bin/setup.${{ matrix.db-type }}.sh

- name: Run tests
shell: 'script -q -e -c "bash {0}"'
run: |
if [[ ${{ matrix.php-version }} == '7.4' && ${{ matrix.symfony-version == '5-max' }} ]]; then
export CODECOVERAGE=1 && vendor/bin/phpunit -c tests/${{ matrix.db-type }}.phpunit.xml --verbose --coverage-clover=tests/coverage.xml
else
vendor/bin/phpunit -c tests/${{ matrix.db-type }}.phpunit.xml
fi
- name: Code Coverage Report
if: success() && matrix.php-version == '7.4' && matrix.symfony-version == '5-max'
uses: codecov/codecov-action@v1
with:
flags: ${{ matrix.php-version }}, ${{ matrix.db-type }}, ${{ matrix.symfony-version }}
file: tests/coverage.xml

code-style-and-static-analysis:
runs-on: ubuntu-22.04
steps:
- name: Setup PHP
id: setup-php
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: json, libxml, pdo, pdo_mysql, pdo_sqlite, pdo_pgsql, sqlite3
coverage: pcov

- uses: actions/checkout@v2

- name: Composer get cache directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Composer cache
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Composer validate
run: composer validate

- name: Composer install
run: composer install --prefer-dist --no-interaction

- name: PHPStan
run: composer stan

- name: Psalm
run: composer psalm -- --php-version=${{ steps.setup-php.outputs.php-version }}

- name: Code Style
run: composer cs-check
vendor/bin/phpunit -c tests/${{ matrix.db-type }}.phpunit.xml tests/Propel/Tests/Runtime/ActiveQuery/ExistsTest.php
7 changes: 5 additions & 2 deletions tests/Propel/Tests/Runtime/ActiveQuery/ExistsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testWhereExists()
[$author1, $author2, $author3] = $this->createTestData();
// all authors with at least one good book
$existsQueryCriteria = BookQuery::create()->filterByTitle('good')->where('Book.AuthorId = Author.Id');
$authors = AuthorQuery::create()->whereExists($existsQueryCriteria)->find($this->con)->getData();
$authors = AuthorQuery::create()->whereExists($existsQueryCriteria)->orderById()->find($this->con)->getData();

$this->assertEquals([$author1, $author3], $authors);
}
Expand All @@ -57,7 +57,7 @@ public function testWhereNotExists()
[$author1, $author2, $author3, $author4] = $this->createTestData();
// all authors with no bad book
$existsQueryCriteria = BookQuery::create()->filterByTitle('bad')->where('Book.AuthorId = Author.Id');
$authors = AuthorQuery::create()->whereNotExists($existsQueryCriteria)->find($this->con)->getData();
$authors = AuthorQuery::create()->whereNotExists($existsQueryCriteria)->orderById()->find($this->con)->getData();

$this->assertEquals([$author3, $author4], $authors);
}
Expand Down Expand Up @@ -109,6 +109,7 @@ public function testUseExistsQuery()
->useExistsQuery('Book')
->filterByTitle('good')
->endUse()
->orderById()
->find($this->con)
->getData();

Expand All @@ -126,6 +127,7 @@ public function testUseNotExistsQuery()
->useNotExistsQuery('Book')
->filterByTitle('bad')
->endUse()
->orderById()
->find($this->con)
->getData();

Expand Down Expand Up @@ -187,6 +189,7 @@ public function testUseExistsQueryWithSpecificClass()
->useExistsQuery('Book', null, GoodBookQuery::class)
->filterByIsGood()
->endUse()
->orderById()
->find($this->con)
->getData();

Expand Down
2 changes: 1 addition & 1 deletion tests/Propel/Tests/Runtime/Connection/PropelPDOTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ class LastMessageHandler extends AbstractHandler
*
* @return bool
*/
public function handle(array $record): bool
public function handle(\Monolog\LogRecord $record): bool
{
$this->latestMessage = (string)$record['message'];

Expand Down

0 comments on commit 0f45479

Please sign in to comment.