Skip to content

Commit

Permalink
Merge 1ba0ded into 0e9958a
Browse files Browse the repository at this point in the history
  • Loading branch information
tienvx committed Oct 10, 2021
2 parents 0e9958a + 1ba0ded commit ba61698
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 46 deletions.
116 changes: 71 additions & 45 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,74 @@ name: main
on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.4', '8.0']
name: PHP ${{ matrix.php-versions }}
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: pcov
tools: phpstan, php-cs-fixer:3, phpunit, composer:v2
#extensions: mbstring, intl

- name: Checkout
uses: actions/checkout@v2

- name: Install PHP dependencies
run: composer install

- name: Run PHP CS Fixer
run: php-cs-fixer fix --diff --dry-run

- name: Run PHPStan
run: phpstan analyse src tests

- name: Test & Generate Code Coverage
run: phpunit

- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=clover.xml -v
if: matrix.php-versions == '7.4'

- name: Install JavaScript dependencies
working-directory: src/Resources/assets
run: yarn install

- name: Test JavaScript
working-directory: src/Resources/assets
run: yarn test --silent
php-cs:
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
tools: phpstan, php-cs-fixer:3, composer:v2

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

- name: Install PHP dependencies
uses: ramsey/composer-install@v1
with:
dependency-versions: 'locked'

- name: Run PHP CS Fixer
run: php-cs-fixer fix --diff --dry-run

- name: Run PHPStan
run: phpstan analyse src tests

test-php:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.4', '8.0']
dependencies: [ 'lowest', 'locked', 'highest' ]
name: PHP ${{ matrix.php-versions }} with ${{ matrix.dependencies }} dependencies
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: pcov
tools: phpunit, composer:v2

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

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

- name: Test & Generate Code Coverage
run: phpunit

- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=clover.xml -v
if: matrix.php-versions == '8.0' && matrix.dependencies == 'locked'

test-js:
runs-on: ubuntu-latest
name: Javascript
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install JavaScript dependencies
working-directory: src/Resources/assets
run: yarn install

- name: Test JavaScript
working-directory: src/Resources/assets
run: yarn test --silent
2 changes: 1 addition & 1 deletion src/Resources/views/bootstrap_5_layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
('data-'~ controllerName ~ '-allow-delete-value'): allow_delete ? 'true' : 'false',
('data-'~ controllerName ~ '-allow-move-up-value'): allow_move_up ? 'true' : 'false',
('data-'~ controllerName ~ '-allow-move-down-value'): allow_move_down ? 'true' : 'false',
('data-'~ controllerName ~ '-prototype-name-value'): prototype_name ? '__name__',
('data-'~ controllerName ~ '-prototype-name-value'): prototype_name|default('__name__'),
('data-'~ controllerName ~ '-call-post-add-on-init-value'): call_post_add_on_init ? 'true' : 'false',
}) %}
{% if ea is defined %}
Expand Down
3 changes: 3 additions & 0 deletions tests/Form/CollectionJsTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public function testDefaultOptions()
$this->assertFalse($view->vars['allow_move_up']);
$this->assertFalse($view->vars['allow_move_down']);
$this->assertFalse($view->vars['call_post_add_on_init']);
$this->assertSame('__name__', $view->vars['prototype_name']);
}

public function testCustomOptions()
Expand All @@ -41,6 +42,7 @@ public function testCustomOptions()
'allow_move_up' => true,
'allow_move_down' => true,
'call_post_add_on_init' => true,
'prototype_name' => '__test__',
])
;
$this->assertSame([
Expand All @@ -53,5 +55,6 @@ public function testCustomOptions()
$this->assertTrue($view->vars['allow_move_up']);
$this->assertTrue($view->vars['allow_move_down']);
$this->assertTrue($view->vars['call_post_add_on_init']);
$this->assertSame('__test__', $view->vars['prototype_name']);
}
}

0 comments on commit ba61698

Please sign in to comment.