Skip to content

Commit

Permalink
Merge pull request #1 from mrprompt/development
Browse files Browse the repository at this point in the history
Refactoring
  • Loading branch information
mrprompt authored Dec 2, 2018
2 parents 0523bb0 + 5bc9380 commit 371e9c8
Show file tree
Hide file tree
Showing 76 changed files with 217 additions and 6,523 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
],
"require": {
"php": "^7.1",
"respect/validation": "^1.1.12"
"mrprompt/shipmentcommon": "^2.0.2"
},
"require-dev": {
"phpunit/phpunit": "^6.1.3",
Expand Down
130 changes: 32 additions & 98 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.3/phpunit.xsd"
bootstrap="./vendor/autoload.php" colors="true" backupGlobals="false"
backupStaticAttributes="false" verbose="true"
stopOnError="true" stopOnFailure="false" stopOnIncomplete="true" stopOnSkipped="true">
backupStaticAttributes="false" verbose="true">
<php>
<const name="APPLICATION_ENV" value="testing"/>
</php>
Expand All @@ -16,17 +15,12 @@
<testsuite name="Received">
<directory>./tests/Received</directory>
</testsuite>

<testsuite name="Common">
<directory>./tests/Common</directory>
</testsuite>
</testsuites>

<filter>
<blacklist>
<directory suffix=".php">./vendor</directory>
<directory suffix=".php">./samples</directory>
<directory suffix=".php">./src/Common/Base/Type</directory>
</blacklist>

<whitelist processUncoveredFilesFromWhitelist="true">
Expand Down
16 changes: 8 additions & 8 deletions samples/cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
*
* @author Thiago Paes <mrprompt@gmail.com>
*/
use MrPrompt\Centercob\Common\Base\Bank;
use MrPrompt\Centercob\Common\Base\Charge;
use MrPrompt\Centercob\Common\Base\ConsumerUnity;
use MrPrompt\Centercob\Common\Base\CreditCard;
use MrPrompt\Centercob\Common\Base\Occurrence;
use MrPrompt\ShipmentCommon\Base\Bank;
use MrPrompt\ShipmentCommon\Base\Charge;
use MrPrompt\ShipmentCommon\Base\ConsumerUnity;
use MrPrompt\ShipmentCommon\Base\CreditCard;
use MrPrompt\ShipmentCommon\Base\Occurrence;

/* @var $vencimento \DateTime */
$vencimento = (new DateTime())->add(new DateInterval('P30D'));
Expand All @@ -21,7 +21,7 @@
'vendedor' => [
'codigo' => 1234, // Código de Cliente na Centercob
'nome' => 'NOME DA EMPRESA',
'documento' => '', // cpf/cnpj de cadastro do vendedor
'documento' => '11111111111', // cpf/cnpj de cadastro do vendedor
'nascimento' => '01011970', // data de nascimento do vendeor
'email' => 'vendedor@loja.com.br', // email do vendedor
'telefone1' => '4811111111',
Expand Down Expand Up @@ -107,7 +107,7 @@
'vendedor' => [
'codigo' => 1234, // Código de Cliente na Centercob
'nome' => 'NOME DA EMPRESA',
'documento' => '', // cpf/cnpj de cadastro do vendedor
'documento' => '11111111111', // cpf/cnpj de cadastro do vendedor
'nascimento' => '01011970', // data de nascimento do vendeor
'email' => 'vendedor@loja.com.br', // email do vendedor
'telefone1' => '4811111111',
Expand Down Expand Up @@ -226,7 +226,7 @@
'vendedor' => [
'codigo' => 1234, // Código de Cliente na Centercob
'nome' => 'NOME DA EMPRESA',
'documento' => '', // cpf/cnpj de cadastro do vendedor
'documento' => '111111111', // cpf/cnpj de cadastro do vendedor
'nascimento' => '01011970', // data de nascimento do vendeor
'email' => 'vendedor@loja.com.br', // email do vendedor
'telefone1' => '4811111111',
Expand Down
10 changes: 5 additions & 5 deletions samples/processado.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
*
* @author Thiago Paes <mrprompt@gmail.com>
*/
use MrPrompt\Centercob\Common\Base\Sequence;
use MrPrompt\ShipmentCommon\Base\Sequence;
use MrPrompt\Centercob\Shipment\File;
use MrPrompt\Centercob\Factory;

require __DIR__ . '/../bootstrap.php';
require __DIR__ . '/bootstrap.php';

/* @var $lista array */
$lista = require __DIR__ . '/cart.php';
Expand All @@ -19,10 +19,10 @@
/* @var $date \DateTime */
$date = new DateTime('2015-05-27');

/* @var $sequence \MrPrompt\Centercob\Common\Base\Sequence */
/* @var $sequence \MrPrompt\ShipmentCommon\Base\Sequence */
$sequence = new Sequence(6);

/* @var $customer \MrPrompt\Centercob\Common\Base\Customer */
/* @var $customer \MrPrompt\ShipmentCommon\Base\Customer */
$customer = Factory::createCustomerFromArray(array_shift($lista));

/* @var $importer \MrPrompt\Centercob\Shipment\File */
Expand All @@ -31,7 +31,7 @@
// importing file data
$result = $importer->read();

/* @var \MrPrompt\Centercob\Common\Base\Cart */
/* @var \MrPrompt\ShipmentCommon\Base\Cart */
$cart = $importer->getCart();

/* @var $lista array */
Expand Down
4 changes: 2 additions & 2 deletions samples/recebido.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
use MrPrompt\Centercob\Factory;
use MrPrompt\Centercob\Received\File;

require __DIR__ . '/../bootstrap.php';
require __DIR__ . '/bootstrap.php';

/* @var $lista array */
$lista = require __DIR__ . '/cart.php';

try {
/* @var $customer \MrPrompt\Centercob\Common\Base\Customer */
/* @var $customer \MrPrompt\ShipmentCommon\Base\Customer */
$customer = Factory::createCustomerFromArray(array_shift($lista));
$date = new DateTime('2015-05-19 18:54:42');

Expand Down
16 changes: 8 additions & 8 deletions samples/remessa.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
*/
use MrPrompt\Centercob\Factory;
use MrPrompt\Centercob\Shipment\File;
use MrPrompt\Centercob\Common\Base\Cart;
use MrPrompt\Centercob\Common\Base\Sequence;
use MrPrompt\ShipmentCommon\Base\Cart;
use MrPrompt\ShipmentCommon\Base\Sequence;

require __DIR__ . '/../bootstrap.php';
require __DIR__ . '/bootstrap.php';

/* @var $today \DateTime */
$today = new DateTime();

/* @var $cart \MrPrompt\Centercob\Common\Base\Cart */
/* @var $cart \MrPrompt\ShipmentCommon\Base\Cart */
$cart = new Cart();

/* @var $lista array */
$lista = require __DIR__ . '/cart.php';

foreach ($lista as $linha) {
if (in_array($linha['cobranca'], [\MrPrompt\Centercob\Common\Base\Charge::BILLET, \MrPrompt\Centercob\Common\Base\Charge::PAYMENT_SLIP])) {
if (in_array($linha['cobranca'], [\MrPrompt\ShipmentCommon\Base\Charge::BILLET, \MrPrompt\ShipmentCommon\Base\Charge::PAYMENT_SLIP])) {
continue;
}

Expand All @@ -40,17 +40,17 @@
echo ' Qtd ', $parcel->getQuantity(), PHP_EOL;
}

echo 'Status: ', $item->getCharge()->getOccurrence()->getDescription(), PHP_EOL;
// echo 'Status: ', $item->getCharge()->getOccurrence()->getDescription(), PHP_EOL;
echo PHP_EOL, PHP_EOL;

$cart->addItem($item);
}

try {
/* @var $sequence \MrPrompt\Centercob\Common\Base\Sequence */
/* @var $sequence \MrPrompt\ShipmentCommon\Base\Sequence */
$sequence = new Sequence(8);

/* @var $customer \MrPrompt\Centercob\Common\Base\Customer */
/* @var $customer \MrPrompt\ShipmentCommon\Base\Customer */
$customer = Factory::createCustomerFromArray(array_shift($lista));

/* @var $exporter \MrPrompt\Centercob\Shipment\File */
Expand Down
Loading

0 comments on commit 371e9c8

Please sign in to comment.