Skip to content

Commit

Permalink
Enhancement: Use GithubActions (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
OskarStark authored Nov 16, 2020
1 parent 9c879e8 commit 66d112c
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 69 deletions.
10 changes: 0 additions & 10 deletions .github/main.workflow

This file was deleted.

84 changes: 84 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
on:
push:
branches:
- 'master'
pull_request:

name: CI

env:
SYMFONY_DEPRECATIONS_HELPER: weak_vendors

jobs:
php-cs-fixer:
name: PHP-CS-Fixer

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga:2.16.7
with:
args: --diff --dry-run

composer-normalize:
name: composer-normalize

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: composer-normalize
uses: docker://ergebnis/composer-normalize-action:0.8.0

test:
name: "PHP ${{ matrix.php-version }} + ${{ matrix.dependency }}"

runs-on: ubuntu-latest

continue-on-error: ${{ matrix.allowed_to_fail }}

strategy:
matrix:
php-version:
- '7.1'
- '7.2'
- '7.3'
- '7.4'
dependency:
- 'lowest'
- 'highest'
allowed_to_fail: [false]
include:
- php-version: '8.0'
dependency: 'lowest'
allowed_to_fail: true
- php-version: '8.0'
dependency: 'highest'
allowed_to_fail: true

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer:v2

- name: Add PHPUnit matcher
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: "Composer install"
uses: "ramsey/composer-install@v1"
with:
dependency-versions: "${{ matrix.dependency }}"

- name: "Run tests"
run: vendor/bin/phpunit
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cs:
docker run --rm -it -w /app -v ${PWD}:/app oskarstark/php-cs-fixer-ga:latest
docker run --rm -it -w /app -v ${PWD}:/app oskarstark/php-cs-fixer-ga:2.16.7
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}
],
"require": {
"php": "^7.1",
"php": ">=7.1",
"behat/behat": "^3.0",
"behat/mink-extension": "^2.3",
"behat/symfony2-extension": "^2.1",
Expand All @@ -31,6 +31,9 @@
"phpunit/phpunit": "^6.0",
"symfony/browser-kit": "^4.3"
},
"config": {
"sort-packages": true
},
"autoload": {
"psr-4": {
"OStark\\": "src/"
Expand Down
4 changes: 2 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.0/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
>

<testsuites>
<testsuite name="Test Suite">
<testsuite name="SonataADminBehatContext Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
Expand Down
25 changes: 3 additions & 22 deletions src/Context/SonataAdminContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,7 @@ public function iShouldSeeFlashMessageWith($status, $message)

$text = $flashMessage->getText();
if (!strstr($text, $message)) {
throw new ExpectationException(
sprintf('Could not find message "%s" in Flash-Message!', $message),
$this->getSession()->getDriver()
);
throw new ExpectationException(sprintf('Could not find message "%s" in Flash-Message!', $message), $this->getSession()->getDriver());
}
}

Expand Down Expand Up @@ -398,10 +395,7 @@ public function iAmAuthenticatedAsUser($username)

$user = $this->userManager->findOneBy(['username' => $username]);
if (null === $user) {
throw new ExpectationException(
sprintf('User with username "%s" does not exist', $username),
$driver
);
throw new ExpectationException(sprintf('User with username "%s" does not exist', $username), $driver);
}

$this->user = $user;
Expand Down Expand Up @@ -655,8 +649,6 @@ public function theFieldShouldNotBeEmtpy($field)
}

/**
* @param UserInterface $user
*
* @throws UnsupportedDriverActionException
*
* @codeCoverageIgnore Selenium2Driver needed
Expand Down Expand Up @@ -698,10 +690,7 @@ private function getCurrentUser(): UserInterface

$user = $this->userManager->findOneBy(['username' => self::DEFAULT_USERNAME]);
if (null === $user) {
throw new ExpectationException(
sprintf('User with username "%s" does not exist', self::DEFAULT_USERNAME),
$this->getSession()->getDriver()
);
throw new ExpectationException(sprintf('User with username "%s" does not exist', self::DEFAULT_USERNAME), $this->getSession()->getDriver());
}

return $user;
Expand Down Expand Up @@ -760,11 +749,6 @@ private function fixFilter(string $filter): string
}

/**
* @param string $locator
* @param string $type
*
* @return NodeElement
*
* @throws ElementNotFoundException
*/
private function findElement(string $locator, string $type): NodeElement
Expand All @@ -779,9 +763,6 @@ private function findElement(string $locator, string $type): NodeElement
}

/**
* @param string $locator
* @param string $type
*
* @throws ExpectationException
*/
private function notFindElement(string $locator, string $type): void
Expand Down

0 comments on commit 66d112c

Please sign in to comment.