Skip to content

Commit

Permalink
BankaTest resurected
Browse files Browse the repository at this point in the history
  • Loading branch information
Vítězslav Dvořák committed Sep 14, 2023
1 parent bbe8657 commit 483cf3b
Show file tree
Hide file tree
Showing 16 changed files with 119 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
@@ -1,4 +1,4 @@
/testing export-ignore
/test export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
Expand Down
2 changes: 1 addition & 1 deletion Examples/config.php
Expand Up @@ -6,4 +6,4 @@
* @copyright (G) 2017 Vitex Software
*/

require_once '../testing/bootstrap.php';
require_once '../test/bootstrap.php';
2 changes: 1 addition & 1 deletion Examples/demo.php
Expand Up @@ -2,7 +2,7 @@

namespace AbraFlexi;

require_once '../testing/bootstrap.php';
require_once '../test/bootstrap.php';

echo _('FlexiBee Connection Test')."\n\n";

Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -339,9 +339,9 @@ Přidejte do vašeho composer.json i cesty k původním testům:
```json
"autoload-dev": {
"psr-4": {
"Test\\": "vendor/spojenet/php-abraflexi/testing/src/AbraFlexi/testing/",
"Test\\": "vendor/spojenet/php-abraflexi/test/src/AbraFlexi/test/",
"Test\\Ease\\": "vendor/vitexsoftware/ease-core/tests/src/Ease",
"Test\\AbraFlexi\\": "vendor/spojenet/php-abraflexi/testing/src/AbraFlexi/",
"Test\\AbraFlexi\\": "vendor/spojenet/php-abraflexi/test/src/AbraFlexi/",
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion debian/rules
Expand Up @@ -24,6 +24,6 @@ override_dh_install:
jq '.version = "'`dpkg-parsechangelog | sed -n 's/^Version: //p'| sed 's/~.*//' `'"' debian/composer.json |sponge debian/composer.json
dh_install
sed -i -e "s/\/\.\.\/\.\.\//\//g" debian/php-spojenet-abraflexi/usr/share/php/AbraFlexi/RO.php
sed -i -e "s/\.\.\/testing\//\/usr\/share\/php\/AbraFlexi\/tools\//g" debian/php-spojenet-abraflexi/usr/share/php/AbraFlexi/tools/*.php
sed -i -e "s/\.\.\/test\//\/usr\/share\/php\/AbraFlexi\/tools\//g" debian/php-spojenet-abraflexi/usr/share/php/AbraFlexi/tools/*.php
sed -i '/git/d' debian/php-spojenet-abraflexi/usr/share/php/AbraFlexi/tools/force_update_all.sh
sed -i -e "s/src\/AbraFlexi\///g" debian/php-spojenet-abraflexi/usr/share/php/AbraFlexi/tools/force_update_all.sh
4 changes: 2 additions & 2 deletions phpunit.xml
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="./testing/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="./test/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">src/AbraFlexi</directory>
</include>
</coverage>
<testsuites>
<testsuite name="all">
<directory>./testing</directory>
<directory>./test</directory>
</testsuite>
</testsuites>
<!-- logging>
Expand Down
102 changes: 102 additions & 0 deletions test/src/AbraFlexi/BankaTest.php
@@ -0,0 +1,102 @@
<?php

namespace Test\AbraFlexi;

use AbraFlexi\Banka;

/**
* Generated by PHPUnit_SkeletonGenerator on 2016-06-10 at 12:31:59.
*/
class BankaTest extends RWTest {

/**
* @var Banka
*/
protected $object;

/**
* Prepare testing payment
*
* @param array $initialData
*
* @return \AbraFlexi\Banka
*/
public static function makeTestPayment($initialData = [], $dayBack = 1) {
$yesterday = new \DateTime();
$yesterday->modify('-' . $dayBack . ' day');

$testCode = 'PAY_' . \Ease\Functions::randomString();

$payment = new \AbraFlexi\Banka($initialData);

$payment->takeData(array_merge([
'kod' => $testCode,
'banka' => 'code:HLAVNI',
'typPohybuK' => 'typPohybu.prijem',
'popis' => 'AbraFlexi Test bank record',
'varSym' => \Ease\Functions::randomNumber(1111, 9999),
'specSym' => \Ease\Functions::randomNumber(111, 999),
'bezPolozek' => true,
'datVyst' => \AbraFlexi\RO::dateToFlexiDate($yesterday),
'typDokl' => \AbraFlexi\RO::code('STANDARD')
], $initialData));
if ($payment->sync()) {
$payment->addStatusMessage($payment->getApiURL() . ' ' . \AbraFlexi\RO::uncode($payment->getDataValue('typPohybuK')) . ' ' . \AbraFlexi\RO::uncode($payment->getRecordIdent()) . ' ' . \AbraFlexi\RO::uncode($payment->getDataValue('sumCelkem')) . ' ' . \AbraFlexi\RO::uncode($payment->getDataValue('mena')),
'success');
} else {
$payment->addStatusMessage(json_encode($payment->getData()), 'debug');
}
return $payment;
}

/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp(): void {
$this->object = new Banka();
}

/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown(): void {

}

/**
* Gives You data able to insert into current evidence
*
* @param string $code custom record code
*
* @return array
*/
public function getDataForInsert($code = 'UnitTest') {
$dataForInsert = parent::getDataForInsert($code);
$loader = new \AbraFlexi\RO(null,
['evidence' => 'bankovni-ucet']);
$bankCodeRaw = $loader->getColumnsFromAbraFlexi([
'kod'], ['limit' => 1]);
$dataForInsert['banka'] = \AbraFlexi\RO::code($bankCodeRaw[0]['kod']);
$dataForInsert['typPohybuK'] = 'typPohybu.prijem';
return $dataForInsert;
}

/**
* @covers AbraFlexi\Banka::stahnoutVypisyOnline
*/
public function testStahnoutVypisyOnline() {
$this->assertInternalType('boolean',
$this->object->stahnoutVypisyOnline());
}

/**
* @covers AbraFlexi\Banka::automatickeParovani
*/
public function testAutomatickeParovani() {
$this->assertInternalType('boolean',
$this->object->automatickeParovani());
}

}
2 changes: 1 addition & 1 deletion tools/current_settings.php
Expand Up @@ -4,7 +4,7 @@

define('EASE_LOGGER', 'console|syslog');

require_once '../testing/bootstrap.php';
require_once '../test/bootstrap.php';

$engine = new RO();
$engine->logBanner('AbraFlexi Structure Static Generator');
Expand Down
2 changes: 1 addition & 1 deletion tools/current_version.php
Expand Up @@ -2,7 +2,7 @@

namespace AbraFlexi;

require_once '../testing/bootstrap.php';
require_once '../test/bootstrap.php';

$statuser = new Status();
echo $statuser->getDataValue('version');
2 changes: 1 addition & 1 deletion tools/find_undocumented_columns.php
Expand Up @@ -2,7 +2,7 @@

namespace AbraFlexi;

require_once '../testing/bootstrap.php';
require_once '../test/bootstrap.php';

/**
* Obtain structure for given evidence
Expand Down
2 changes: 1 addition & 1 deletion tools/time_to_update.php
Expand Up @@ -2,7 +2,7 @@

namespace AbraFlexi;

require_once '../testing/bootstrap.php';
require_once '../test/bootstrap.php';

if ((new Status())->getDataValue('version') === \AbraFlexi\EvidenceList::$version) {
echo 'false';
Expand Down
2 changes: 1 addition & 1 deletion tools/update_actions_class.php
Expand Up @@ -9,7 +9,7 @@
define('EASE_LOGGER', 'console|syslog');
}

require_once '../testing/bootstrap.php';
require_once '../test/bootstrap.php';
require_once __DIR__ . '/common.php';

$outFile = 'Actions.php';
Expand Down
2 changes: 1 addition & 1 deletion tools/update_evidencelist_class.php
Expand Up @@ -5,7 +5,7 @@
define('EASE_APPNAME', 'AbraFlexiStaticEvidenceListGenerator');
define('EASE_LOGGER', 'console|syslog');

require_once '../testing/bootstrap.php';
require_once '../test/bootstrap.php';
require_once __DIR__ . '/common.php';

$outFile = 'EvidenceList.php';
Expand Down
2 changes: 1 addition & 1 deletion tools/update_formats_class.php
Expand Up @@ -5,7 +5,7 @@
define('EASE_APPNAME', 'AbraFlexi Formats');
define('EASE_LOGGER', 'console|syslog');

require_once '../testing/bootstrap.php';
require_once '../test/bootstrap.php';
require_once __DIR__ . '/common.php';

$outFile = 'Formats.php';
Expand Down
2 changes: 1 addition & 1 deletion tools/update_properties_class.php
Expand Up @@ -5,7 +5,7 @@
define('EASE_APPNAME', 'FlexiPeehUP');
define('EASE_LOGGER', 'console|syslog');

require_once '../testing/bootstrap.php';
require_once '../test/bootstrap.php';
require_once __DIR__ . '/common.php';

function evidenceToClass($evidence) {
Expand Down
2 changes: 1 addition & 1 deletion tools/update_relations_class.php
Expand Up @@ -5,7 +5,7 @@
define('EASE_APPNAME', 'FlexiPeehUP');
define('EASE_LOGGER', 'console|syslog');

require_once '../testing/bootstrap.php';
require_once '../test/bootstrap.php';
require_once __DIR__ . '/common.php';

$outFile = 'Relations.php';
Expand Down

0 comments on commit 483cf3b

Please sign in to comment.