Skip to content

Commit

Permalink
Merge 9f5e3dd into 1e41e0f
Browse files Browse the repository at this point in the history
  • Loading branch information
adrenalinkin committed Dec 30, 2021
2 parents 1e41e0f + 9f5e3dd commit 37975d4
Show file tree
Hide file tree
Showing 17 changed files with 728 additions and 66 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ jobs:
php-cs-fixer:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
coverage: none
tools: php-cs-fixer:2.19.3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
coverage: none
tools: php-cs-fixer:2.19.3

- name: Run PHP-CS-Fixer
run: php-cs-fixer fix --dry-run --diff
- name: Run PHP-CS-Fixer
run: php-cs-fixer fix --dry-run --diff
59 changes: 17 additions & 42 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,24 @@ on: [push, pull_request]

jobs:
tests:
name: "PHP ${{ matrix.php }} + Symfony ${{ matrix.symfony }} + Composer ${{ matrix.dependency }}"
name: "PHP${{ matrix.php }} Symfony${{ matrix.symfony}} ${{ matrix.composer-flags }}"
runs-on: ubuntu-latest

strategy:
fail-fast: true
fail-fast: false
matrix:
include:
# Lowest PHP with the lowest dependencies for every supported lowest major version of the Symfony
- php: '7.1'
coverage: xdebug
dependency: lowest
symfony: '^3.4'
- php: '7.1'
coverage: xdebug
dependency: lowest
symfony: '^4.0'
- php: '7.2'
coverage: xdebug
dependency: lowest
symfony: '^5.0'

# All supported php versions with the highest dependencies for any supported Symfony version
- php: '7.1'
coverage: xdebug
dependency: highest
symfony: 'any'
coverage: 'xdebug'
composer-flags: '--prefer-lowest'
- php: '7.2'
coverage: pcov
dependency: highest
symfony: 'any'
symfony: '^4.0'
- php: '7.3'
coverage: pcov
dependency: highest
symfony: 'any'
symfony: '^5.0'
- php: '7.4'
coverage: pcov
dependency: highest
symfony: 'any'
symfony: '^5.0'
coverage: 'pcov'

steps:
- name: Checkout source
Expand All @@ -51,35 +31,30 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: ${{ matrix.coverage }}
coverage: ${{ matrix.coverage || 'none' }}

- name: Require Symfony version
if: matrix.symfony != 'any'
run: |
composer global require --no-interaction --no-progress symfony/flex:^1.11
composer config extra.symfony.require ${{ matrix.symfony }}
- name: Install Symfony Flex
run: composer global require -o --no-interaction --no-progress symfony/flex:^1.11

- name: Validate composer.json
run: composer validate
- name: Require Symfony version
run: composer config extra.symfony.require ${{ matrix.symfony }}

- name: Update composer dependencies
uses: ramsey/composer-install@v1
with:
dependency-versions: ${{ matrix.dependency }}
run: composer update -o --no-interaction --no-progress ${{ matrix.composer-flags }}

- name: Run test suite
run: ./vendor/bin/simple-phpunit -v

- name: Install php-coveralls
run: composer global require --no-interaction --no-progress php-coveralls/php-coveralls
run: composer global require -o --no-interaction --no-progress php-coveralls/php-coveralls

- name: Upload coverage results to Coveralls
if: matrix.coverage
uses: nick-invision/retry@v2
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: |
"PHP ${{ matrix.php }} + Symfony ${{ matrix.symfony }} + Composer ${{ matrix.dependency }}"
COVERALLS_FLAG_NAME: "PHP${{ matrix.php }} Symfony${{ matrix.symfony}}"
with:
timeout_seconds: 60
max_attempts: 3
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Removed all unnecessary rows from the `.gitignore` according to `.gitignore_global` use instead.
### Fixed
- Fixed incompatible with Symfony 5 according to new contract in `OptionResolver::offsetGet()`.
- Added conflict with `nelmio/api-doc-bundle` version lower than `3.4`.
- Fixed error when `SwaggerResolver` without any validator.
- Fixed incorrect behavior of the `multipleOf` validation when received value and `multipleOf` was a float type.
- Fixed not worked array validation for the `multi` format.
Expand Down
2 changes: 1 addition & 1 deletion Tests/Fixtures/SwaggerPhp/Models/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Cart
public $totalPrice;

/**
* @var array
* @var CartItem[]
*
* @SWG\Property(
* minItems=0,
Expand Down
2 changes: 1 addition & 1 deletion Tests/Fixtures/SwaggerPhp/Models/CustomerFull.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class CustomerFull
public $secondName;

/**
* @var array
* @var string[]
*
* @SWG\Property(
* uniqueItems=true,
Expand Down
2 changes: 1 addition & 1 deletion Tests/Fixtures/SwaggerPhp/Models/CustomerNew.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class CustomerNew
public $secondName;

/**
* @var array
* @var string[]
*
* @SWG\Property(
* uniqueItems=true,
Expand Down
85 changes: 85 additions & 0 deletions Tests/Functional/Bundle/TestBundle/Controller/CartController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php

declare(strict_types=1);

/*
* This file is part of the SwaggerResolverBundle package.
*
* (c) Viktor Linkin <adrenalinkin@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Linkin\Bundle\SwaggerResolverBundle\Tests\Functional\Bundle\TestBundle\Controller;

use Linkin\Bundle\SwaggerResolverBundle\Tests\Fixtures\SwaggerPhp\Models\Cart;
use Linkin\Bundle\SwaggerResolverBundle\Tests\Fixtures\SwaggerPhp\Models\CartItem;
use Linkin\Bundle\SwaggerResolverBundle\Tests\Fixtures\SwaggerPhp\Models\ResponseCreated;
use Nelmio\ApiDocBundle\Annotation\Model;
use Swagger\Annotations as SWG;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

/**
* @author Viktor Linkin <adrenalinkin@gmail.com>
*
* @SWG\Tag(name="cart")
*/
class CartController
{
/**
* Add new item into cart or increase count of existed.
*
* @Route(name="cart_add_item", path="/cart", methods={"PUT"})
*
* @SWG\Parameter(
* name="x-auth-token",
* in="header",
* description="Alternative token for the authorization",
* required=true,
* type="string",
* pattern="^\w{36}$",
* )
* @SWG\Parameter(
* name="cart",
* in="body",
* description="Item data to add to the cart",
* required=true,
* @Model(type=CartItem::class),
* )
* @SWG\Response(
* response=201,
* description="New item into cart ID",
* @Model(type=ResponseCreated::class),
* )
*/
public function addItem(): Response
{
return new Response(Response::HTTP_CREATED);
}

/**
* Returns all items from the cart.
*
* @Route(name="cart_get", path="/cart", methods={"GET"})
*
* @SWG\Parameter(
* name="x-auth-token",
* in="header",
* description="Alternative token for the authorization",
* required=true,
* type="string",
* pattern="^\w{36}$",
* )
* @SWG\Response(
* response=200,
* description="Cart data",
* @Model(type=Cart::class),
* )
*/
public function getCartData(): Response
{
return new Response();
}
}

0 comments on commit 37975d4

Please sign in to comment.