diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index ea6800a..65b5381 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,10 @@ # CHANGELOG +## Version 0.7.0 2019-05-16 + +- Remove CfdiStatus::request() & CfdiStatus::active() (fixes #7). + + ## Version 0.6.1 2019-05-16 - On version 0.6.0 class names where renamed but property names where not. diff --git a/src/CfdiStatus.php b/src/CfdiStatus.php index fb837bc..37f7487 100644 --- a/src/CfdiStatus.php +++ b/src/CfdiStatus.php @@ -30,43 +30,11 @@ public function __construct( $this->cancellation = $cancellation; } - /** - * Use method query(), this method will be removed on version 0.7.0 - * - * @deprecated 0.6.1:0.7.0 Due naming consistency - * @see query() - * @return Status\QueryStatus - */ - public function request(): Status\QueryStatus - { - trigger_error( - sprintf('Method %s::request() has been deprecated, use query() instead', __CLASS__), - E_USER_DEPRECATED - ); - return $this->query(); - } - public function query(): Status\QueryStatus { return $this->query; } - /** - * Use method document(), this method will be removed on version 0.7.0 - * - * @deprecated 0.6.1:0.7.0 Due naming consistency - * @see document() - * @return Status\DocumentStatus - */ - public function active(): Status\DocumentStatus - { - trigger_error( - sprintf('Method %s::active() has been deprecated, use document() instead', __CLASS__), - E_USER_DEPRECATED - ); - return $this->document(); - } - public function document(): Status\DocumentStatus { return $this->document; diff --git a/tests/Unit/CfdiStatusTest.php b/tests/Unit/CfdiStatusTest.php index 7b18aaa..b6c4c91 100644 --- a/tests/Unit/CfdiStatusTest.php +++ b/tests/Unit/CfdiStatusTest.php @@ -10,41 +10,20 @@ use PhpCfdi\SatEstadoCfdi\Status\DocumentStatus; use PhpCfdi\SatEstadoCfdi\Status\QueryStatus; use PhpCfdi\SatEstadoCfdi\Tests\TestCase; -use PHPUnit\Framework\Error\Deprecated; class CfdiStatusTest extends TestCase { - public function testActivePropertyThrowsDeprecationNotice(): void + public function testObjectReturnCorrectProperties(): void { - $cfdiStatus = new CfdiStatus( - QueryStatus::found(), - DocumentStatus::active(), - CancellableStatus::notCancellable(), - CancellationStatus::undefined() - ); - - // silence errors on this call to check that active returns the same as document - $this->assertSame($cfdiStatus->document(), @$cfdiStatus->active()); - - // now call active without silence operator, this error will be catched as exception by phpunit - $this->expectException(Deprecated::class); - $cfdiStatus->active(); - } - - public function testRequestPropertyThrowsDeprecationNotice(): void - { - $cfdiStatus = new CfdiStatus( - QueryStatus::found(), - DocumentStatus::active(), - CancellableStatus::notCancellable(), - CancellationStatus::undefined() - ); - - // silence errors on this call to check that active returns the same as document - $this->assertSame($cfdiStatus->query(), @$cfdiStatus->request()); - - // now call active without silence operator, this error will be catched as exception by phpunit - $this->expectException(Deprecated::class); - $cfdiStatus->request(); + $query = QueryStatus::found(); + $document = DocumentStatus::active(); + $cancellable = CancellableStatus::notCancellable(); + $cancellation = CancellationStatus::undefined(); + $cfdiStatus = new CfdiStatus($query, $document, $cancellable, $cancellation); + + $this->assertSame($query, $cfdiStatus->query()); + $this->assertSame($document, $cfdiStatus->document()); + $this->assertSame($cancellable, $cfdiStatus->cancellable()); + $this->assertSame($cancellation, $cfdiStatus->cancellation()); } }