Passed
Push — master ( f06476...64043f )
by Carlos
05:13 queued 13s
created

ConceptoPartidaTest::testCreateWithNewCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * This file is part of FacturaScripts
4
 * Copyright (C) 2017-2021  Carlos Garcia Gomez     <[email protected]>
5
 *
6
 * This program is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU Lesser General Public License as
8
 * published by the Free Software Foundation, either version 3 of the
9
 * License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 * GNU Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public License
17
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18
 */
19
namespace FacturaScripts\Test\Core\Model;
20
21
use FacturaScripts\Core\Model\ConceptoPartida;
22
use FacturaScripts\Test\Core\LogErrorsTrait;
23
use PHPUnit\Framework\TestCase;
24
25
final class ConceptoPartidaTest extends TestCase
26
{
27
28
    use LogErrorsTrait;
29
30
    public function testCreate()
31
    {
32
        $concept = new ConceptoPartida();
33
        $concept->codconcepto = 'Test';
34
        $concept->descripcion = 'Test Concept';
0 ignored issues
show
Bug introduced by
The property descripcion does not seem to exist on FacturaScripts\Core\Model\ConceptoPartida.
Loading history...
35
        $this->assertTrue($concept->save(), 'concept-cant-save');
36
        $this->assertNotNull($concept->primaryColumnValue(), 'concept-not-stored');
37
        $this->assertTrue($concept->exists(), 'concept-cant-persist');
38
        $this->assertTrue($concept->delete(), 'concept-cant-delete');
39
    }
40
41
    public function testCreateWithNewCode()
42
    {
43
        $concept = new ConceptoPartida();
44
        $concept->descripcion = 'Test Concept with new code';
0 ignored issues
show
Bug introduced by
The property descripcion does not seem to exist on FacturaScripts\Core\Model\ConceptoPartida.
Loading history...
45
        $this->assertTrue($concept->save(), 'concept-cant-save');
46
        $this->assertTrue($concept->delete(), 'concept-cant-delete');
47
    }
48
49
    protected function tearDown()
50
    {
51
        $this->logErrors();
52
    }
53
}
54