<commit_before><?php
/**
 * Created by PhpStorm.
 * User: Administrador
 * Date: 18/10/2017
 * Time: 07:10 PM
 */

declare(strict_types=1);

namespace Tests\Greenter\Xml\Parser;

use Greenter\Model\Sale\Receipt;
use Greenter\Xml\Parser\ReceiptParser;
use PHPUnit\Framework\TestCase;

class ReceiptParserTest extends TestCase
{
    /**
     * @dataProvider providerDocs
     * @param string $filename
     */
    public function testParseDoc($filename)
    {
        $xml = file_get_contents($filename);
        /**@var $doc Receipt */
        $doc = $this->getParser()->parse($xml);

        $this->assertStringStartsWith('E', $doc->getSerie());
        $this->assertLessThanOrEqual(8, strlen($doc->getCorrelativo()));
        $this->assertEquals(11, strlen($doc->getReceptor()->getNumDoc()));
        $this->assertNotEmpty($doc->getMontoLetras());
        $this->assertNotEmpty($doc->getConcepto());
        $this->assertNotEmpty($doc->getSubTotal());
        $this->assertNotEmpty($doc->getTotal());
        $this->assertNotEmpty($doc->getPorcentaje());
    }<commit_msg>Assert receipt properties in xml-parser<commit_after><?php
/**
 * Created by PhpStorm.
 * User: Administrador
 * Date: 18/10/2017
 * Time: 07:10 PM
 */

declare(strict_types=1);

namespace Tests\Greenter\Xml\Parser;

use Greenter\Model\Sale\Receipt;
use Greenter\Xml\Parser\ReceiptParser;
use PHPUnit\Framework\TestCase;

class ReceiptParserTest extends TestCase
{
    /**
     * @dataProvider providerDocs
     * @param string $filename
     */
    public function testParseDoc($filename)
    {
        $xml = file_get_contents($filename);
        /**@var $doc Receipt */
        $doc = $this->getParser()->parse($xml);

        $this->assertNotEmpty($doc->getName());
        $this->assertStringStartsWith('E', $doc->getSerie());
        $this->assertLessThanOrEqual(8, strlen($doc->getCorrelativo()));
        $this->assertEquals(11, strlen($doc->getReceptor()->getNumDoc()));
        $this->assertNotNull($doc->getPerson());
        $this->assertNotNull($doc->getFechaEmision());
        $this->assertNotEmpty($doc->getMontoLetras());
        $this->assertNotEmpty($doc->getConcepto());
        $this->assertNotEmpty($doc->getSubTotal());
        $this->assertIsFloat($doc->getRetencion());
        $this->assertNotEmpty($doc->getTotal());
        $this->assertNotEmpty($doc->getPorcentaje());
    }
{'fraction_non_alphanumeric': 0.17297979797979798, 'fraction_numerical': 0.013468013468013467, 'mean_word_length': 3.606589147286822, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 5}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7056979', 'n_tokens_mistral': 765, 'n_tokens_neox': 734, 'n_words': 108}