Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #7 from eclipxe13/development
Browse files Browse the repository at this point in the history
Version 0.2.3
  • Loading branch information
eclipxe13 authored Jan 10, 2021
2 parents 0b64216 + 56e2f34 commit 2ed6efe
Show file tree
Hide file tree
Showing 19 changed files with 83 additions and 90 deletions.
5 changes: 2 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
* text=auto

# Do not put this files on a distribution package (by .gitignore)
/vendor export-ignore
/build export-ignore
/vendor/ export-ignore
/composer.lock export-ignore

# Do not put this files on a distribution package
/build/ export-ignore
/tests/ export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php_cs.dist export-ignore
/.phplint.yml export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/phpcs.xml.dist export-ignore
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# do not include this files on git
/vendor
/build
/composer.lock
11 changes: 0 additions & 11 deletions .phplint.yml

This file was deleted.

7 changes: 7 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@ filter:
- 'vendor/'

build:
dependencies:
override:
- composer self-update --2 --stable --no-interaction --no-progress
- composer remove squizlabs/php_codesniffer friendsofphp/php-cs-fixer phpstan/phpstan --dev --no-interaction --no-progress --no-update
- composer update --no-interaction --no-progress
nodes:
analysis:
project_setup:
override: true
tests:
override:
- php-scrutinizer-run --enable-security-analysis
Expand Down
31 changes: 12 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,27 @@
language: php

# This triggers builds to run on the new TravisCI infrastructure.
# See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/
sudo: false

# php compatibility
php:
- "7.2"
- "7.3"
- "7.4snapshot"

matrix:
allow_failures:
- php: "7.4snapshot"
php: ["7.2", "7.3", "7.4", "8.0"]

cache:
- directories:
- $HOME/.composer

env:
global:
- PHP_CS_FIXER_IGNORE_ENV=yes

before_script:
- phpenv config-rm xdebug.ini || true
- travis_retry composer install --no-interaction --prefer-dist
- mkdir -p build
- travis_retry composer self-update --2 --stable --no-interaction --no-progress
- travis_retry composer upgrade --prefer-dist --no-interaction --no-progress

script:
- vendor/bin/phplint
- vendor/bin/php-cs-fixer fix --verbose
- vendor/bin/phpcbf --colors -sp src/ tests/
- vendor/bin/php-cs-fixer fix --dry-run --verbose
- vendor/bin/phpcs --colors -sp src/ tests/
- vendor/bin/phpunit --testdox --verbose
- vendor/bin/phpstan.phar analyse --no-progress --level max src/ tests/
- vendor/bin/phpstan analyse --no-progress --level max src/ tests/

notifications:
email: false
email:
if: branch = master
13 changes: 6 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ When you do begin working on your feature, here are some guidelines to consider:
If you are having issues with coding standars use `php-cs-fixer` and `phpcbf`

```shell
vendor/bin/php-cs-fixer fix -v
vendor/bin/phpcbf src/ tests/
vendor/bin/php-cs-fixer fix --verbose
vendor/bin/phpcbf --colors -sp src/ tests/
```

## Running Tests
Expand All @@ -75,9 +75,8 @@ If any of these do not pass, it will result in a complete build failure.
Before you can run these, be sure to `composer install` or `composer update`.

```shell
vendor/bin/parallel-lint src/ tests/
vendor/bin/phpcs -sp src/ tests/
vendor/bin/php-cs-fixer fix -v --dry-run
vendor/bin/phpunit --coverage-text
vendor/bin/phpstan analyse --level max src/ tests/
vendor/bin/php-cs-fixer fix --dry-run --verbose
vendor/bin/phpcs --colors -sp src/ tests/
vendor/bin/phpunit --testdox --verbose
vendor/bin/phpstan analyse --no-progress --verbose --level max src/ tests/
```
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2019 PHPCFDI
Copyright (c) 2019 - 2021 PhpCfdi https://www.phpcfdi.com/

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
19 changes: 6 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ de la librería [`phpcfdi/sat-estado-cfdi`](https://github.com/phpcfdi/sat-estad

Para contactar al servicio **no requiere `ext-soap`** en su lugar usa los estándares de PHP-FIG
[PSR-18: HTTP Client](https://www.php-fig.org/psr/psr-18/) y [PSR-17: HTTP Factories](https://www.php-fig.org/psr/psr-17/).
De esta forma, tu puedes usar el cliente HTTP que mejor te convenga.
De esta forma, puedes usar el cliente HTTP que mejor te convenga.

Los estándares de los que depende son:

Expand All @@ -43,7 +43,6 @@ O puedes ver en [Packagist](https://packagist.org/) los que te agraden:
- PSR-17: <https://packagist.org/providers/psr/http-factory-implementation>
- PSR-7: <https://packagist.org/providers/psr/http-message-implementation>


## Instalación

Usa [composer](https://getcomposer.org/)
Expand All @@ -52,7 +51,6 @@ Usa [composer](https://getcomposer.org/)
composer require phpcfdi/sat-estado-cfdi-http-psr
```


## Ejemplo básico de uso

```php
Expand All @@ -75,7 +73,6 @@ if ($response->cancellable()->isNotCancellable()) {
}
```


## Integraciones

Puedes ver los siguientes recursos para integrar `phpcfdi/sat-estado-cfdi-http-psr` a tu proyecto.
Expand All @@ -85,44 +82,40 @@ Puedes ver los siguientes recursos para integrar `phpcfdi/sat-estado-cfdi-http-p
- [Integración genérica](docs/integracion-generica.md)
Implementación de los PSR-17 y PSR-18 que decidas, ejemplo usando Sunrise.


## Compatilibilidad

Esta librería se mantendrá compatible con al menos la versión con
[soporte activo de PHP](http://php.net/supported-versions.php) más reciente.
[soporte activo de PHP](https://www.php.net/supported-versions.php) más reciente.

También utilizamos [Versionado Semántico 2.0.0](https://semver.org/lang/es/) por lo que puedes usar esta librería
sin temor a romper tu aplicación.


## Contribuciones

Las contribuciones con bienvenidas. Por favor lee [CONTRIBUTING][] para más detalles
y recuerda revisar el archivo de tareas pendientes [TODO][] y el [CHANGELOG][].

y recuerda revisar el archivo de tareas pendientes [TODO][] y el archivo [CHANGELOG][].

## Copyright and License

The `phpcfdi/sat-estado-cfdi-http-psr` library is copyright © [PhpCfdi](https://www.phpcfdi.com/)
and licensed for use under the MIT License (MIT). Please see [LICENSE][] for more information.


[contributing]: https://github.com/phpcfdi/sat-estado-cfdi-http-psr/blob/master/CONTRIBUTING.md
[changelog]: https://github.com/phpcfdi/sat-estado-cfdi-http-psr/blob/master/docs/CHANGELOG.md
[todo]: https://github.com/phpcfdi/sat-estado-cfdi-http-psr/blob/master/docs/TODO.md

[source]: https://github.com/phpcfdi/sat-estado-cfdi-http-psr
[release]: https://github.com/phpcfdi/sat-estado-cfdi-http-psr/releases
[license]: https://github.com/phpcfdi/sat-estado-cfdi-http-psr/blob/master/LICENSE
[build]: https://travis-ci.org/phpcfdi/sat-estado-cfdi-http-psr?branch=master
[build]: https://travis-ci.com/phpcfdi/sat-estado-cfdi-http-psr?branch=master
[quality]: https://scrutinizer-ci.com/g/phpcfdi/sat-estado-cfdi-http-psr/
[coverage]: https://scrutinizer-ci.com/g/phpcfdi/sat-estado-cfdi-http-psr/code-structure/master/code-coverage
[downloads]: https://packagist.org/packages/phpcfdi/sat-estado-cfdi-http-psr

[badge-source]: http://img.shields.io/badge/source-phpcfdi/sat--estado--cfdi--http--psr-blue?style=flat-square
[badge-source]: https://img.shields.io/badge/source-phpcfdi/sat--estado--cfdi--http--psr-blue?style=flat-square
[badge-release]: https://img.shields.io/github/release/phpcfdi/sat-estado-cfdi-http-psr?style=flat-square
[badge-license]: https://img.shields.io/github/license/phpcfdi/sat-estado-cfdi-http-psr?style=flat-square
[badge-build]: https://img.shields.io/travis/phpcfdi/sat-estado-cfdi-http-psr/master?style=flat-square
[badge-build]: https://img.shields.io/travis/com/phpcfdi/sat-estado-cfdi-http-psr/master?style=flat-square
[badge-quality]: https://img.shields.io/scrutinizer/g/phpcfdi/sat-estado-cfdi-http-psr/master?style=flat-square
[badge-coverage]: https://img.shields.io/scrutinizer/coverage/g/phpcfdi/sat-estado-cfdi-http-psr/master?style=flat-square
[badge-downloads]: https://img.shields.io/packagist/dt/phpcfdi/sat-estado-cfdi-http-psr?style=flat-square
2 changes: 2 additions & 0 deletions build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
25 changes: 11 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,21 @@
"require": {
"php": ">=7.2",
"ext-dom": "*",
"phpcfdi/sat-estado-cfdi": "^0.6.1|^0.7.0",
"phpcfdi/sat-estado-cfdi": "^0.7.0",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0"
},
"require-dev": {
"ext-curl": "*",
"phpcfdi/cfdi-expresiones": "^2.0",
"sunrise/http-client-curl": "^1.1.0",
"symfony/http-client": "^5.2",
"sunrise/http-factory": "^1.0",
"sunrise/http-message": "^1.0",
"phpunit/phpunit": "^8.0",
"overtrue/phplint": "^1.0",
"squizlabs/php_codesniffer": "^3.0",
"friendsofphp/php-cs-fixer": "^2.4",
"phpstan/phpstan-shim": "^0.11"
"phpstan/phpstan": "^0.12"
},
"suggest": {
"phpcfdi/cfdi-expresiones": "Genera expresiones de CFDI 3.3, CFDI 3.2 y RET 1.0"
Expand All @@ -57,29 +56,27 @@
"scripts": {
"dev:build": ["@dev:fix-style", "@dev:test"],
"dev:check-style": [
"vendor/bin/php-cs-fixer fix --dry-run --verbose",
"vendor/bin/phpcs --colors -sp src/ tests/"
"@php vendor/bin/php-cs-fixer fix --dry-run --verbose",
"@php vendor/bin/phpcs --colors -sp src/ tests/"
],
"dev:fix-style": [
"vendor/bin/php-cs-fixer fix --verbose",
"vendor/bin/phpcbf --colors -sp src/ tests/"
"@php vendor/bin/php-cs-fixer fix --verbose",
"@php vendor/bin/phpcbf --colors -sp src/ tests/"
],
"dev:test": [
"vendor/bin/phplint",
"@dev:check-style",
"vendor/bin/phpunit --testdox --verbose --stop-on-failure",
"find . -type f -name .phpunit.result.cache -delete",
"vendor/bin/phpstan analyse --no-progress --verbose --level max src/ tests/"
"@php vendor/bin/phpunit --testdox --verbose --stop-on-failure",
"@php vendor/bin/phpstan analyse --no-progress --verbose --level max src/ tests/"
],
"dev:coverage": [
"@php -dzend_extension=xdebug.so vendor/bin/phpunit --coverage-text --coverage-html build/coverage/html/"
"@php -dzend_extension=xdebug.so vendor/bin/phpunit --testdox --coverage-html build/coverage/html/"
]
},
"scripts-descriptions": {
"dev:build": "DEV: run dev:fix-style dev:tests and dev:docs, run before pull request",
"dev:check-style": "DEV: search for code style errors using php-cs-fixer and phpcs",
"dev:fix-style": "DEV: fix code style errors using php-cs-fixer and phpcbf",
"dev:test": "DEV: run phplint, @dev:check-style, phpunit and phpstan",
"dev:test": "DEV: run dev:check-style, phpunit and phpstan",
"dev:coverage": "DEV: run phpunit with xdebug and storage coverage in build/coverage/html/"
}
}
17 changes: 12 additions & 5 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# CHANGELOG

## Version 0.2.3 2021-01-09

- Update license year, HNY from PhpCfdi!
- Ensure compatibility to PHP 8.0.
- Upgrade to PHPStan 0.12.
- Remove PHPLint.
- Travis-CI: Update config, compatiblity matrix and build pipeline.
- Scrutinizer: Update build pipeline.
- Change dependency to `phpcfdi/sat-estado-cfdi: ^^0.7.0`.

## Version 0.2.2 2019-09-23

- Fix usage of `RequestInterface`, to retrieve full body is recommended to use `StreamInterface::__toString()`.
Expand All @@ -12,21 +22,18 @@
- Write `.phpunit.result.cache` on `build/`.
- On Travis CI add PHP version `7.4snapshot` with allow failure
- Let Scrutinizer CI decide which PHP version to use



## Version 0.2.1 2019-05-16

- Change dependence versions `phpcfdi/sat-estado-cfdi: ^0.6.1|^0.7.0`.
See <https://github.com/phpcfdi/sat-estado-cfdi/issues/7>



## Version 0.2.0 2019-03-29

- Implemented `phpcfdi/sat-estado-cfdi:^0.6.0`
- Improve documentation and integrations
- Fix CONTRIBUTING project


## Version 0.1.0 2019-03-28

- Implemented `phpcfdi/sat-estado-cfdi:^0.5.0`
2 changes: 1 addition & 1 deletion docs/integracion-generica.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $consumer = new HttpConsumerClient($factory);
## Extendiendo HttpConsumerFactory

Otra forma de hacerlo es extendiendo la clase `HttpConsumerFactory`, un ejemplo de esto se puede ver
en <https://github.com/phpcfdi/sat-estado-cfdi-http-psr/blob/master/tests/SunriseHttpConsumerFactory.php>
en <https://github.com/phpcfdi/sat-estado-cfdi-http-psr/blob/master/tests/TestingHttpConsumerFactory.php>


## Implementando HttpConsumerFactoryInterface
Expand Down
8 changes: 6 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.0/phpunit.xsd"
bootstrap="./tests/bootstrap.php" colors="true" cacheResultFile="build/.phpunit.result.cache">
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
cacheResultFile="build/phpunit.result.cache"
colors="true"
verbose="true"
bootstrap="tests/bootstrap.php">
<testsuites>
<testsuite name="Default">
<directory>./tests/</directory>
Expand Down
2 changes: 1 addition & 1 deletion src/Internal/SoapXml.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function createXmlRequest(string $expression): string
->appendChild($document->createElementNS($this->uri(), 'c:Consulta'))
->appendChild($document->createElementNS($this->uri(), 'c:expresionImpresa'))
->appendChild($document->createTextNode($expression));
$xml = $document->saveXML();
$xml = $document->saveXML() ?: '';
return $xml;
}
}
2 changes: 1 addition & 1 deletion tests/Compliance/ComplianceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ComplianceTest extends TestCase
{
public function testCompliance(): void
{
$sunriseFactory = $this->createSunriseFactory();
$sunriseFactory = $this->createHttpConsumerFactory();

$client = new HttpConsumerClient($sunriseFactory);
$tester = new ComplianceTester($client);
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

class TestCase extends \PHPUnit\Framework\TestCase
{
public function createSunriseFactory(): HttpConsumerFactoryInterface
public function createHttpConsumerFactory(): HttpConsumerFactoryInterface
{
return new SunriseHttpConsumerFactory();
return new TestingHttpConsumerFactory();
}

public static function filePath(string $append = ''): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\StreamFactoryInterface;
use Sunrise\Http\Client\Curl\Client as SunriseHttpClient;
use Sunrise\Http\Factory\RequestFactory as SunriseRequestFactory;
use Sunrise\Http\Factory\ResponseFactory as SunriseResponseFactory;
use Sunrise\Http\Factory\StreamFactory as SunriseStreamFactory;
use Symfony\Component\HttpClient\Psr18Client as SymfonyHttpClient;

class SunriseHttpConsumerFactory extends HttpConsumerFactory implements HttpConsumerFactoryInterface
class TestingHttpConsumerFactory extends HttpConsumerFactory implements HttpConsumerFactoryInterface
{
public function __construct(
ClientInterface $httpClient = null,
Expand All @@ -23,7 +23,7 @@ public function __construct(
) {
$streamFactoryInterface = $streamFactoryInterface ?? new SunriseStreamFactory();
$requestFactoryInterface = $requestFactoryInterface ?? new SunriseRequestFactory();
$httpClient = $httpClient ?? new SunriseHttpClient(new SunriseResponseFactory());
$httpClient = $httpClient ?? new SymfonyHttpClient(null, new SunriseResponseFactory(), $streamFactoryInterface);
parent::__construct($httpClient, $requestFactoryInterface, $streamFactoryInterface);
}
}
Loading

0 comments on commit 2ed6efe

Please sign in to comment.