|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* FlexiPeeHP - Objekt účetního období. |
|
4
|
|
|
* |
|
5
|
|
|
* @author Vítězslav Dvořák <[email protected]> |
|
6
|
|
|
* @copyright (C) 2015,2016 Spoje.Net |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace Test\FlexiPeeHP; |
|
10
|
|
|
|
|
11
|
|
|
use FlexiPeeHP\UcetniObdobi; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Generated by PHPUnit_SkeletonGenerator on 2016-04-27 at 17:32:10. |
|
15
|
|
|
*/ |
|
16
|
|
|
class UcetniObdobiTest extends FlexiBeeTest |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* @var UcetniObdobi |
|
20
|
|
|
*/ |
|
21
|
|
|
protected $object; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Sets up the fixture, for example, opens a network connection. |
|
25
|
|
|
* This method is called before a test is executed. |
|
26
|
|
|
*/ |
|
27
|
|
|
protected function setUp() |
|
28
|
|
|
{ |
|
29
|
|
|
$this->object = new UcetniObdobi; |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Tears down the fixture, for example, closes a network connection. |
|
34
|
|
|
* This method is called after a test is executed. |
|
35
|
|
|
*/ |
|
36
|
|
|
protected function tearDown() |
|
37
|
|
|
{ |
|
38
|
|
|
|
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @covers FlexiPeeHP\UcetniObdobi::createYearsFrom |
|
43
|
|
|
*/ |
|
44
|
|
|
public function testCreateYearsFrom() |
|
45
|
|
|
{ |
|
46
|
|
|
//Načíst stávající roky |
|
47
|
|
|
$fbyears = $this->object->getColumnsFromFlexibee(['kod'], null, 'kod'); |
|
48
|
|
|
$years = []; |
|
49
|
|
|
foreach ($fbyears as $fbyear) { |
|
50
|
|
|
if (is_numeric($fbyear['kod'])) { |
|
51
|
|
|
$years[] = $fbyear['kod']; |
|
52
|
|
|
} |
|
53
|
|
|
} |
|
54
|
|
|
asort($years); |
|
55
|
|
|
$firstyear = current($years); |
|
56
|
|
|
$testyear = $firstyear - 2; |
|
57
|
|
|
|
|
58
|
|
|
|
|
59
|
|
|
//Založit další dva předcházející roky |
|
60
|
|
|
$this->object->createYearsFrom($testyear, $testyear + 1); |
|
|
|
|
|
|
61
|
|
|
|
|
62
|
|
|
//Znovu přečíst roky z FlexiBee |
|
63
|
|
|
$newfbyears = $this->object->getColumnsFromFlexibee(['kod'], null, 'kod'); |
|
64
|
|
|
$newyears = []; |
|
65
|
|
|
foreach ($newfbyears as $newfbyear) { |
|
66
|
|
|
if (is_numeric($newfbyear['kod'])) { |
|
67
|
|
|
$newyears[$newfbyear['kod']] = $newfbyear['kod']; |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
//Byly požadované roky založeny ? |
|
72
|
|
|
$this->assertArrayHasKey($testyear, $newyears); |
|
73
|
|
|
$this->assertArrayHasKey($testyear + 1, $newyears); |
|
74
|
|
|
} |
|
75
|
|
|
} |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: