-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from kbca/master
Correção para considerar os valores decimais, pois estavam indo com zero
- Loading branch information
Showing
10 changed files
with
104 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ tmp/* | |
.~lock.* | ||
.buildpath | ||
.project | ||
.idea | ||
.settings | ||
composer.lock | ||
/resources/cache | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace Umbrella\Tests\Ya\RetornoBoleto\SegmentosCNAB240; | ||
|
||
use Umbrella\Tests\Ya\RetornoBoleto\RetornoCNAB240Test; | ||
use Umbrella\Ya\RetornoBoleto\ProcessFactory; | ||
use Umbrella\Ya\RetornoBoleto\ProcessHandler; | ||
|
||
abstract class AbstractSegmentoTestCase extends RetornoCNAB240Test | ||
{ | ||
public function segmentoProvider($segmento) | ||
{ | ||
$segmentos = array(); | ||
foreach ($this->cnabProvider() as $fileName) { | ||
$cnab = ProcessFactory::getRetorno(current($fileName)); | ||
|
||
$processor = new ProcessHandler($cnab); | ||
$retorno = $processor->processar(); | ||
|
||
$lotes = $retorno->getLotes(); | ||
foreach ($lotes->get(0)->getDetails() as $detail) { | ||
if ($detail->getSegmento() == $segmento) { | ||
$segmentos[] = array($detail); | ||
} | ||
} | ||
} | ||
return $segmentos; | ||
} | ||
|
||
public function segmentoTProvider() | ||
{ | ||
return $this->segmentoProvider('T'); | ||
} | ||
|
||
public function segmentoUProvider() | ||
{ | ||
return $this->segmentoProvider('U'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Umbrella\Tests\Ya\RetornoBoleto\SegmentosCNAB240; | ||
|
||
class SegmentoTTest extends AbstractSegmentoTestCase | ||
{ | ||
/** | ||
* @dataProvider segmentoTProvider | ||
* @param $fileName | ||
*/ | ||
public function testMonetaryValues($segmentoTDetail) | ||
{ | ||
$this->assertEquals('T', $segmentoTDetail->getSegmento()); | ||
$this->assertTrue(is_double($segmentoTDetail->getValorTarifa())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Umbrella\Tests\Ya\RetornoBoleto\SegmentosCNAB240; | ||
|
||
class SegmentoUTest extends AbstractSegmentoTestCase | ||
{ | ||
/** | ||
* @dataProvider segmentoUProvider | ||
* @param $fileName | ||
*/ | ||
public function testMonetaryValues($segmentoUDetail) | ||
{ | ||
$this->assertEquals('U', $segmentoUDetail->getSegmento()); | ||
$this->assertTrue(is_double($segmentoUDetail->getDadosTitulo()->getValorPago())); | ||
} | ||
} |