Skip to content

Commit

Permalink
cs fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
giansalex committed Apr 8, 2019
1 parent 71a0a39 commit 5941e29
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 63 deletions.
8 changes: 4 additions & 4 deletions tests/Ws/Builder/ServiceBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Created by PhpStorm.
* User: Soporte
* Date: 6/11/2018
* Time: 12:25
* Time: 12:25.
*/

namespace Tests\Greenter\Ws\Services;
Expand All @@ -16,7 +16,7 @@
use Mockery;

/**
* Class ServiceBuilderTest
* Class ServiceBuilderTest.
*/
class ServiceBuilderTest extends \PHPUnit_Framework_TestCase
{
Expand All @@ -36,7 +36,7 @@ protected function setUp()
public function testCreateBillService()
{
$this->builder->setClient($this->getClientMock());
/**@var $service BillSender */
/** @var $service BillSender */
$service = $this->builder->build(BillSender::class);

$this->assertInstanceOf(BillSender::class, $service);
Expand Down Expand Up @@ -100,4 +100,4 @@ private function getClientMock()

return $client;
}
}
}
4 changes: 2 additions & 2 deletions tests/Ws/Builder/SoapBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Created by PhpStorm.
* User: Soporte
* Date: 23/01/2019
* Time: 17:42
* Time: 17:42.
*/

namespace Tests\Greenter\Ws\Builder;
Expand Down Expand Up @@ -54,4 +54,4 @@ public function testCreateConsultClient()
$this->assertInstanceOf(SoapClient::class, $client);
$client->call('getStatusCdr', []);
}
}
}
13 changes: 6 additions & 7 deletions tests/Ws/Reader/DomCdrReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Created by PhpStorm.
* User: Giansalex
* Date: 22/07/2017
* Time: 16:29
* Time: 16:29.
*/

namespace Tests\Greenter\Ws\Reader;
Expand All @@ -12,8 +12,7 @@
use Greenter\Ws\Reader\XmlReader;

/**
* Class DomCdrReaderTest
* @package Tests\Greenter\Ws\Reader
* Class DomCdrReaderTest.
*/
class DomCdrReaderTest extends \PHPUnit_Framework_TestCase
{
Expand All @@ -22,7 +21,7 @@ class DomCdrReaderTest extends \PHPUnit_Framework_TestCase
*/
public function testGetResponse()
{
$path = __DIR__ . '/../../Resources/R-20600995805-01-F001-1.xml';
$path = __DIR__.'/../../Resources/R-20600995805-01-F001-1.xml';
$xml = file_get_contents($path);
$reader = $this->getCdrReader();
$cdr = $reader->getCdrResponse($xml);
Expand All @@ -39,7 +38,7 @@ public function testGetResponse()
*/
public function testGetResponseWithNotes()
{
$path = __DIR__ . '/../../Resources/R-20600995805-01-F001-3.xml';
$path = __DIR__.'/../../Resources/R-20600995805-01-F001-3.xml';
$xml = file_get_contents($path);
$reader = $this->getCdrReader();
$cdr = $reader->getCdrResponse($xml);
Expand Down Expand Up @@ -73,7 +72,7 @@ public function testNotFoundResponse()
public function testEmptyNodes()
{
$doc = new \DOMDocument();
$doc->load(__DIR__ . '/../../Resources/R-20600995805-01-F001-3.xml');
$doc->load(__DIR__.'/../../Resources/R-20600995805-01-F001-3.xml');
$referenceId = $doc->documentElement
->childNodes->item(27)
->childNodes->item(1)
Expand All @@ -91,4 +90,4 @@ private function getCdrReader()
{
return new DomCdrReader(new XmlReader());
}
}
}
5 changes: 3 additions & 2 deletions tests/Ws/Reader/XmlFilenameExtractorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Created by PhpStorm.
* User: Soporte
* Date: 28/01/2019
* Time: 16:32
* Time: 16:32.
*/

namespace Tests\Greenter\Ws\Reader;
Expand All @@ -28,6 +28,7 @@ protected function setUp()

/**
* @dataProvider getFiles
*
* @param string $filename
*/
public function testGetName($filename)
Expand Down Expand Up @@ -70,4 +71,4 @@ public function getFiles()

return $params;
}
}
}
11 changes: 6 additions & 5 deletions tests/Ws/Resolver/TypeResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Created by PhpStorm.
* User: Soporte
* Date: 29/01/2019
* Time: 17:42
* Time: 17:42.
*/

namespace Tests\Greenter\Ws\Resolver;
Expand Down Expand Up @@ -33,6 +33,7 @@ protected function setUp()

/**
* @dataProvider getFilesTypeExpected
*
* @param string $expectedType
* @param string $file
*/
Expand Down Expand Up @@ -69,11 +70,11 @@ public function getFilesTypeExpected()
[Note::class, __DIR__.'/../../Resources/Name/20123456789-08-FF01-123.xml'],
[Retention::class, __DIR__.'/../../Resources/Name/20123456789-20-R001-123.xml'],
[Perception::class, __DIR__.'/../../Resources/Name/20123456789-40-P001-123.xml'],
[Summary::class,__DIR__.'/../../Resources/20000000001-RC-20171119-001.xml'],
[Voided::class,__DIR__.'/../../Resources/20600995805-RA-20170719-01.xml'],
[Reversion::class,__DIR__.'/../../Resources/Name/20123456789-RR-20190122-00111.xml'],
[Summary::class, __DIR__.'/../../Resources/20000000001-RC-20171119-001.xml'],
[Voided::class, __DIR__.'/../../Resources/20600995805-RA-20170719-01.xml'],
[Reversion::class, __DIR__.'/../../Resources/Name/20123456789-RR-20190122-00111.xml'],
];

return $params;
}
}
}
8 changes: 4 additions & 4 deletions tests/Ws/Services/ConsultCdrServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Created by PhpStorm.
* User: Giansalex
* Date: 09/09/2018
* Time: 15:16
* Time: 15:16.
*/

namespace Tests\Greenter\Ws\Services;
Expand All @@ -16,7 +16,7 @@ public function testGetStatusInvalidUser()
{
$service = $this->getConsultService();

$result = $service->getStatus('20000000001', '01','F001', 1);
$result = $service->getStatus('20000000001', '01', 'F001', 1);

$this->assertFalse($result->isSuccess());
$this->assertNotNull($result->getError());
Expand All @@ -27,7 +27,7 @@ public function testGetStatusCdrInvalidUser()
{
$service = $this->getConsultService();

$result = $service->getStatusCdr('20000000001', '01','F001', 1);
$result = $service->getStatusCdr('20000000001', '01', 'F001', 1);

$this->assertFalse($result->isSuccess());
$this->assertNull($result->getCdrZip());
Expand Down Expand Up @@ -68,4 +68,4 @@ public function testGetErrorCodeFromCdr()
$this->assertNotNull($result->getError());
$this->assertGreaterThan(0, intval($result->getError()->getCode()));
}
}
}
11 changes: 5 additions & 6 deletions tests/Ws/Services/ConsultCdrServiceTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Created by PhpStorm.
* User: Giansalex
* Date: 09/09/2018
* Time: 15:19
* Time: 15:19.
*/

namespace Tests\Greenter\Ws\Services;
Expand All @@ -16,7 +16,7 @@
use Mockery;

/**
* Trait ConsultCdrServiceTrait
* Trait ConsultCdrServiceTrait.
*/
trait ConsultCdrServiceTrait
{
Expand Down Expand Up @@ -56,12 +56,11 @@ private function getConsultServiceMock()
$obj = new \stdClass();
$obj->statusCdr = new \stdClass();

if ($ruc === '20000000001') {
if ('20000000001' === $ruc) {
$obj->statusCdr->statusCode = '0';
$obj->statusCdr->statusMessage = 'ACEPTADA';
$obj->statusCdr->content = file_get_contents(__DIR__.'/../../Resources/cdrBaja.zip');
}
else {
} else {
$obj->statusCdr->statusCode = '004';
$obj->statusCdr->statusMessage = 'Constancia Existe';
$obj->statusCdr->content = file_get_contents(__DIR__.'/../../Resources/cdr-rechazo.zip');
Expand All @@ -75,4 +74,4 @@ private function getConsultServiceMock()

return $service;
}
}
}
34 changes: 19 additions & 15 deletions tests/Ws/Services/FeSunatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Created by PhpStorm.
* User: Administrador
* Date: 17/07/2017
* Time: 05:18 PM
* Time: 05:18 PM.
*/

namespace Tests\Greenter\Ws\Services;
Expand All @@ -12,8 +12,7 @@
use Greenter\Model\Response\SummaryResult;

/**
* Class FeSunatTest
* @package TgetExtSunatests\Greenter\Ws\Services
* Class FeSunatTest.
*/
class FeSunatTest extends \PHPUnit_Framework_TestCase
{
Expand All @@ -27,11 +26,13 @@ public function testSendInvoice()
$wss = $this->getBillSenderMock();
$response = $wss->send($nameXml, $xml);

/**@var $response BillResult */
/** @var $response BillResult */
$this->assertTrue($response->isSuccess());
$this->assertNotNull($response->getCdrResponse());
$this->assertContains('La Factura numero F001-00000001, ha sido aceptada',
$response->getCdrResponse()->getDescription());
$this->assertContains(
'La Factura numero F001-00000001, ha sido aceptada',
$response->getCdrResponse()->getDescription()
);
}

public function testSendInvoiceBillSender()
Expand All @@ -42,11 +43,13 @@ public function testSendInvoiceBillSender()
$wss = $this->getBillSender();
$response = $wss->send($nameXml, $xml);

/**@var $response BillResult */
/** @var $response BillResult */
$this->assertTrue($response->isSuccess());
$this->assertNotNull($response->getCdrResponse());
$this->assertContains('La Factura numero F001-00000001, ha sido aceptada',
$response->getCdrResponse()->getDescription());
$this->assertContains(
'La Factura numero F001-00000001, ha sido aceptada',
$response->getCdrResponse()->getDescription()
);
}

public function testSendInvalidInvoice()
Expand All @@ -57,7 +60,7 @@ public function testSendInvalidInvoice()
$wss = $this->getBillSenderThrow('0156');
$response = $wss->send($nameXml, $xml);

/**@var $response BillResult */
/** @var $response BillResult */
$this->assertFalse($response->isSuccess());
$this->assertEquals('0156', $response->getError()->getCode());
$this->assertEquals('El archivo ZIP esta corrupto', $response->getError()->getMessage());
Expand All @@ -71,7 +74,7 @@ public function testSendVoided()
$wss = $this->getSummarySenderMock();
$result = $wss->send($nameXml, $xml);

/**@var $result SummaryResult */
/** @var $result SummaryResult */
$this->assertNotNull($result);
$this->assertTrue($result->isSuccess());
$this->assertEquals(13, strlen($result->getTicket()));
Expand All @@ -89,7 +92,7 @@ public function testSendVoidedSummarySender()
return;
}

/**@var $result SummaryResult */
/** @var $result SummaryResult */
$this->assertNotNull($result);
$this->assertTrue($result->isSuccess());
$this->assertEquals(13, strlen($result->getTicket()));
Expand All @@ -103,7 +106,7 @@ public function testSendInvalidVoided()
$wss = $this->getSummarySenderThrow('2001');
$result = $wss->send($nameXml, $xml);

/**@var $result SummaryResult */
/** @var $result SummaryResult */
$this->assertNotNull($result);
$this->assertFalse($result->isSuccess());
$this->assertEquals('2001', $result->getError()->getCode());
Expand All @@ -117,7 +120,7 @@ public function testSendSummaryV2()
$wss = $this->getSummarySender();
$result = $wss->send($nameXml, $xml);

/**@var $result SummaryResult */
/** @var $result SummaryResult */
$this->assertNotNull($result);
$this->assertFalse($result->isSuccess());
$this->assertNotNull($result->getError());
Expand Down Expand Up @@ -149,6 +152,7 @@ public function testGetStatusPending()

/**
* @dataProvider codeProvider
*
* @param $code
*/
public function testFaultError($code)
Expand All @@ -163,7 +167,7 @@ public function codeProvider()
{
return [
['NO CODE'],
['111111111']
['111111111'],
];
}
}
Loading

0 comments on commit 5941e29

Please sign in to comment.