1
0
mirror of synced 2024-11-22 03:46:02 +03:00

update dependencies

This commit is contained in:
Pavel 2022-12-22 15:40:59 +03:00 committed by GitHub
commit 910bf5e118
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 58 additions and 4477 deletions

View File

@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['7.2', '7.3', '7.4', '8.0']
php-version: ['7.3', '7.4', '8.0', '8.1']
steps:
- uses: actions/checkout@v2
- name: Setup PHP ${{ matrix.php-version }}

1
.gitignore vendored
View File

@ -195,3 +195,4 @@ build/*
# Test report & coverage
test-report.xml
clover.xml
composer.lock

View File

@ -16,17 +16,17 @@
"ext-curl": "*",
"ext-json": "*",
"jms/serializer": "3.*",
"symfony/validator": "5.4.*",
"doctrine/annotations": "1.13.*",
"doctrine/cache": "1.11.*",
"guzzlehttp/guzzle": "6.*",
"symfony/intl": "^5.4"
"symfony/validator": "5.4.*|^6",
"doctrine/annotations": "^1",
"guzzlehttp/guzzle": "7.*",
"symfony/intl": "5.4.*|^6",
"symfony/cache": "5.4.*|^6"
},
"require-dev": {
"phpmd/phpmd": "2.*",
"squizlabs/php_codesniffer": "3.4.*",
"symfony/dotenv": "5.4.*",
"phpunit/phpunit": "8.5.*",
"phpunit/phpunit": "^9",
"phpstan/phpstan": "0.12.*"
},
"support": {

4436
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 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/6.5/phpunit.xsd"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
colors="false"
bootstrap="tests/bootstrap.php"
@ -15,22 +13,21 @@
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
stopOnRisky="false"
>
stopOnRisky="false">
<coverage>
<include>
<directory>src</directory>
</include>
<report>
<clover outputFile="clover.xml"/>
</report>
</coverage>
<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>src</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-clover" target="clover.xml"/>
<log type="junit" target="/tmp/logfile.xml"/>
<junit outputFile="/tmp/logfile.xml"/>
</logging>
</phpunit>

View File

@ -13,7 +13,12 @@ namespace RetailCrm\Mg\Bot;
use BadMethodCallException;
use ErrorException;
use Exception;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Utils;
use InvalidArgumentException;
use Psr\Http\Message\ResponseInterface;
use RetailCrm\Common\Exception\InvalidJsonException;
use RetailCrm\Common\Exception\LimitException;
use RetailCrm\Common\Exception\NotFoundException;
@ -22,11 +27,6 @@ use RetailCrm\Common\Serializer;
use RetailCrm\Common\Url;
use RuntimeException;
use Symfony\Component\Validator\Validation;
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Exception\GuzzleException;
use Psr\Http\Message\ResponseInterface;
use function GuzzleHttp\Psr7\stream_for;
/**
* Class HttpClient
@ -137,7 +137,7 @@ class HttpClient
[self::METHOD_POST, self::METHOD_PUT, self::METHOD_PATCH, self::METHOD_DELETE]
) && is_string($requestBody)
) {
$request = $request->withBody(stream_for($requestBody));
$request = $request->withBody(Utils::streamFor($requestBody));
}
$responseObject = null;
@ -216,14 +216,15 @@ class HttpClient
/**
* Validate given class
*
* @param string $class
* @param object $class
*
* @return void
*/
private function validateRequest($class)
private function validateRequest(object $class)
{
$validator = Validation::createValidatorBuilder()
->enableAnnotationMapping()
->addDefaultDoctrineAnnotationReader()
->getValidator();
$errors = $validator->validate($class);

View File

@ -27,7 +27,7 @@ class UploadFileByUrlRequest implements ModelInterface
*
* @Type("string")
* @Accessor(getter="getUrl",setter="setUrl")
* @Assert\NotBlank()
* @Assert\NotBlank(allowNull=false)
* @Assert\Url()
*/
private $url;

View File

@ -27,17 +27,32 @@ class FileTest extends TestCase
* @group("upload")
* @throws \Exception
*/
public function testUploadFileByUrlException()
public function testUploadFileByUrlEmpty()
{
$client = self::getApiClient(
null,
null,
false,
$this->getEmptyResponse(400)
$this->getErrorsResponse(400, 'Something is not quite right.')
);
self::expectException(\InvalidArgumentException::class);
$client->uploadFileByUrl('');
}
/**
* @group("upload")
* @throws \Exception
*/
public function testUploadFileByUrlInvalid()
{
$client = self::getApiClient(
null,
null,
false,
$this->getErrorsResponse(400, 'Something is not quite right.')
);
self::expectException(\InvalidArgumentException::class);
$client->uploadFileByUrl('rar');
}

View File

@ -6,8 +6,11 @@ if (function_exists('date_default_timezone_set')
date_default_timezone_set(date_default_timezone_get());
}
(static function () {
$loader = include dirname(__DIR__) . '/vendor/autoload.php';
$loader->add('RetailCrm\\Mg\\Bot\\Test', __DIR__);
})();
use Symfony\Component\Dotenv\Dotenv;