Skip to content

Commit

Permalink
set builder xml options, update license
Browse files Browse the repository at this point in the history
  • Loading branch information
giansalex committed Jan 25, 2018
1 parent 8153250 commit a2ecf5d
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 9 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Giancarlos Salas
Copyright (c) 2018 Giancarlos Salas

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 11 additions & 1 deletion src/Greenter/See.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class See
*
* @var array
*/
private $options = [];
private $options = ['autoescape' => false];

/**
* See constructor.
Expand All @@ -82,6 +82,16 @@ public function __construct()
$this->factory->setSigner($this->signer);
}

/**
* Set Xml Builder Options.
*
* @param array $options
*/
public function setBuilderOptions(array $options)
{
$this->options = array_merge($this->options, $options);
}

/**
* @param string $directory
*/
Expand Down
5 changes: 4 additions & 1 deletion tests/Greenter/Factory/CeFactoryBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ protected function getExtService()
*/
protected function getXmlSigned(DocumentInterface $document)
{
$builder = new $this->builders[get_class($document)]();
$builder = new $this->builders[get_class($document)]([
'cache' => false,
'strict_variables' => true,
]);
$this->factory->setBuilder($builder);

return $this->factory->getXmmlSigned($document);
Expand Down
5 changes: 4 additions & 1 deletion tests/Greenter/Factory/FeFactoryBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ protected function getFactoryResult(DocumentInterface $document)
* @return BuilderInterface
*/
protected function getBuilder(DocumentInterface $document) {
return new $this->builders[get_class($document)]();
return new $this->builders[get_class($document)]([
'cache' => false,
'strict_variables' => true,
]);
}

protected function getValidator($errors)
Expand Down
8 changes: 4 additions & 4 deletions tests/Greenter/Factory/FeFactoryXmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Greenter\Model\DocumentInterface;
use Greenter\Model\Response\BaseResult;
use Greenter\Services\SenderInterface;
use Greenter\Validator\DocumentValidatorInterface;

/**
* Class FeFactoryXmlTest
Expand Down Expand Up @@ -124,10 +123,11 @@ private function getFactoryForXml(DocumentInterface $document)
->will($this->returnValue((new BaseResult())
->setSuccess(true)));

/**@var $validator DocumentValidatorInterface */

/**@var $sender SenderInterface */
$builder = new $this->builders[get_class($document)]();
$builder = new $this->builders[get_class($document)]([
'cache' => false,
'strict_variables' => true,
]);
$factory = $this->factory
->setBuilder($builder)
->setSender($sender);
Expand Down
6 changes: 6 additions & 0 deletions tests/Greenter/SeeCeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ private function getSee($endpoint)
{
$see = new See();
$see->setService($endpoint);
$see->setBuilderOptions([
'strict_variables' => true,
'optimizations' => 0,
'debug' => true,
'cache' => false,
]);
$see->setCredentials('20000000001MODDATOS', 'moddatos');
$see->setCertificate(file_get_contents(__DIR__.'/../Resources/SFSCert.pem'));

Expand Down
7 changes: 6 additions & 1 deletion tests/Greenter/SeeFeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ private function getSee()
{
$see = new See();
$see->setService(SunatEndpoints::FE_BETA);
$see->setCachePath(__DIR__.'/../Resources');
$see->setBuilderOptions([
'strict_variables' => true,
'optimizations' => 0,
'debug' => true,
]);
$see->setCachePath(false);
$see->setCredentials('20000000001MODDATOS', 'moddatos');
$see->setCertificate(file_get_contents(__DIR__.'/../Resources/SFSCert.pem'));

Expand Down

0 comments on commit a2ecf5d

Please sign in to comment.