Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - Introduce tests on platforms #549

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/test-platforms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

name: "Test on platforms"

on:
pull_request:
push:
branches:
- "1.3.x"

jobs:
test-mysql:
name: "Tests mysql"
runs-on: "ubuntu-latest"

env:
DATABASE_URL: mysql://root@127.0.0.1:3306/phpstan_doctrine

services:
mysql:
VincentLanglet marked this conversation as resolved.
Show resolved Hide resolved
image: mysql:${{ matrix.mysql-version }}
options: >-
--health-cmd "mysqladmin ping --silent"
--name=mysqlcontainer
-e MYSQL_ALLOW_EMPTY_PASSWORD=yes
-e MYSQL_DATABASE=phpstan_doctrine
ports:
- 3306:3306

strategy:
fail-fast: false
matrix:
php-version:
- "8.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We definitelly need to check "before 8.1" and "after 8.1" as there were some major changes.

mysql-version:
- '5.7'
- '8.0'
VincentLanglet marked this conversation as resolved.
Show resolved Hide resolved

steps:
- name: "Checkout"
uses: actions/checkout@v3

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
ini-file: development
extensions: "mongodb"

- name: "Install dependencies"
run: "composer update --no-interaction --no-progress"

- name: Change mysql sql_mode
run: "docker exec mysqlcontainer mysql -u root -e \"SET GLOBAL sql_mode = '';\""

- name: "Tests"
run: "vendor/bin/phpunit --group=mysql"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ check: lint cs tests phpstan

.PHONY: tests
tests:
php vendor/bin/phpunit
php vendor/bin/phpunit --exclude-group=platform

.PHONY: lint
lint:
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

<testsuites>
<testsuite name="PHPStan for Doctrine">
<directory suffix="TestCase.php">tests</directory>
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
Expand Down
17 changes: 17 additions & 0 deletions tests/Type/Doctrine/Query/MysqlQueryResultTypeWalkerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php declare(strict_types = 1);

namespace PHPStan\Type\Doctrine\Query;

/**
* @group platform
* @group mysql
*/
class MysqlQueryResultTypeWalkerTest extends PDOQueryResultTypeWalkerTest
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently I extends PDOQueryResultTypeWalkerTest but later we'll work his own dataprovider

{

protected static function getEntityManagerPath(): string
{
return __DIR__ . '/../data/QueryResult/entity-manager-mysql.php';
}

}
Loading
Loading