Skip to content

Commit

Permalink
Merge pull request #7 from tecnospeed/hotfix/rps
Browse files Browse the repository at this point in the history
fix: data de correção RPS
  • Loading branch information
ferfabricio authored Mar 21, 2019
2 parents 376b02e + 781c922 commit 26cac94
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog
Alterações na biblioteca

## [1.4.2] - 21/03/2019
### Corrigido

Data de emissão no RPS

## [1.4.1] - 20/03/2019
### Corrigido

Expand Down
4 changes: 2 additions & 2 deletions examples/nfse.array.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
];

$rps = [
'dataEmissao' => \DateTime(),
'competencia' => \DateTime()
'dataEmissao' => new \DateTime(),
'competencia' => new \DateTime()
];

$servico = [
Expand Down
2 changes: 1 addition & 1 deletion src/Nfse/Rps.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function setDataEmissao(\DateTimeInterface $dataEmissao)

public function getDataEmissao()
{
return $this->competencia;
return $this->dataEmissao;
}

public function setCompetencia(\DateTimeInterface $competencia)
Expand Down
12 changes: 7 additions & 5 deletions tests/Nfse/RpsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ public function testWithInvalidDataEmissao()
*/
public function testWithValidRpsData()
{
$dateCompare = new \DateTime('now');
$dateBase = new \DateTime('now');
$competencia = $dateBase->format('Y-m-d');
$dataEmissao = $dateBase->format('Y-m-d\TH:i:s');
$rps = new Rps();
$rps->setDataEmissao($dateCompare);
$rps->setCompetencia($dateCompare);
$rps->setDataEmissao($dateBase);
$rps->setCompetencia($dateBase);

$this->assertSame($rps->getDataEmissao(), $dateCompare->format('Y-m-d'));
$this->assertSame($rps->getCompetencia(), $dateCompare->format('Y-m-d'));
$this->assertSame($rps->getDataEmissao(), $dataEmissao);
$this->assertSame($rps->getCompetencia(), $competencia);
}
}
2 changes: 1 addition & 1 deletion tests/NfseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function testWithValidData()
$this->assertSame($nfse->getIdIntegracao(), 1234);
$this->assertSame($nfse->getImpressao()->getCamposCustomizados()['teste'], 'testeImpressao');
$this->assertSame($nfse->getPrestador()->getCertificado(), '5b855b0926ddb251e0f0ef42');
$this->assertSame($nfse->getRps()->getDataEmissao(), $dateCompare->format('Y-m-d'));
$this->assertSame($nfse->getRps()->getDataEmissao(), $dateCompare->format('Y-m-d\TH:i:s'));
$this->assertSame($nfse->getServico()->getIdIntegracao(), 'A001XT');
$this->assertSame($nfse->getSubstituicao(), false);
$this->assertSame($nfse->getTomador()->getCpfCnpj(), '00000000000191');
Expand Down

0 comments on commit 26cac94

Please sign in to comment.