Skip to content

Commit

Permalink
move graph test to standalone file
Browse files Browse the repository at this point in the history
  • Loading branch information
giansalex committed Jun 3, 2019
1 parent 1e1af1d commit 9a88dc0
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 52 deletions.
52 changes: 0 additions & 52 deletions tests/Functional/ConsultApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,58 +53,6 @@ public function testConsultDni()
return;
}
$this->assertEquals('ROBERTO CARLOS', $person->nombres);
// $this->assertEquals('4', $person->codVerifica);
}

public function testConsultGraph()
{
$q = <<<QL
query {
company(ruc: "20131312955") {
ruc
razonSocial
nombreComercial
telefonos
tipo
estado
condicion
direccion
departamento
provincia
distrito
fechaInscripcion
sistEmsion
sistContabilidad
actExterior
actEconomicas
cpPago
sistElectronica
fechaEmisorFe
cpeElectronico
fechaPle
padrones
}
}
QL;

$response = $this->runApp('POST', '/api/v1/graph', ['query' => $q]);

$this->assertEquals(200, $response->getStatusCode());
$obj = json_decode((string)$response->getBody());

/**@var $company Company */
$company = $obj->data->company;

$this->assertFalse(isset($obj->errors));
$this->assertContains('SUPERINTENDENCIA NACIONAL', $company->razonSocial);
$this->assertEquals('HABIDO', $company->condicion);
$this->assertEquals('ACTIVO', $company->estado);
$this->assertNotEmpty($company->direccion);
$this->assertNotEmpty($company->departamento);
$this->assertNotEmpty($company->provincia);
$this->assertNotEmpty($company->distrito);
$this->assertNotEmpty($company->fechaInscripcion);
}

public function testConsultUserSol()
Expand Down
60 changes: 60 additions & 0 deletions tests/Functional/GraphApiTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php


namespace Tests\Functional;

use Peru\Sunat\Company;

class GraphApiTest extends BaseTestCase
{
public function testConsultGraph()
{
$q = <<<QL
query {
company(ruc: "20131312955") {
ruc
razonSocial
nombreComercial
telefonos
tipo
estado
condicion
direccion
departamento
provincia
distrito
fechaInscripcion
sistEmsion
sistContabilidad
actExterior
actEconomicas
cpPago
sistElectronica
fechaEmisorFe
cpeElectronico
fechaPle
padrones
}
}
QL;

$response = $this->runApp('POST', '/api/graph', ['query' => $q]);

$this->assertEquals(200, $response->getStatusCode());
$obj = json_decode((string)$response->getBody());

/**@var $company Company */
$company = $obj->data->company;

$this->assertFalse(isset($obj->errors));
$this->assertContains('SUPERINTENDENCIA NACIONAL', $company->razonSocial);
$this->assertEquals('HABIDO', $company->condicion);
$this->assertEquals('ACTIVO', $company->estado);
$this->assertNotEmpty($company->direccion);
$this->assertNotEmpty($company->departamento);
$this->assertNotEmpty($company->provincia);
$this->assertNotEmpty($company->distrito);
$this->assertNotEmpty($company->fechaInscripcion);
}
}

0 comments on commit 9a88dc0

Please sign in to comment.