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\AgenciaTransporte; |
22
|
|
|
use FacturaScripts\Test\Core\LogErrorsTrait; |
23
|
|
|
use PHPUnit\Framework\TestCase; |
24
|
|
|
|
25
|
|
|
final class AgenciaTransporteTest extends TestCase |
26
|
|
|
{ |
27
|
|
|
|
28
|
|
|
use LogErrorsTrait; |
29
|
|
|
|
30
|
|
|
public function testCreate() |
31
|
|
|
{ |
32
|
|
|
$agency = new AgenciaTransporte(); |
33
|
|
|
$agency->codtrans = 'Test'; |
34
|
|
|
$agency->nombre = 'Test Agency'; |
35
|
|
|
$this->assertTrue($agency->save(), 'agency-cant-save'); |
36
|
|
|
$this->assertNotNull($agency->primaryColumnValue(), 'agency-not-stored'); |
37
|
|
|
$this->assertTrue($agency->exists(), 'agency-cant-persist'); |
38
|
|
|
$this->assertTrue($agency->delete(), 'agency-cant-delete'); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function testCreateWithNewCode() |
42
|
|
|
{ |
43
|
|
|
$agency = new AgenciaTransporte(); |
44
|
|
|
$agency->nombre = 'Test Agency with new code'; |
45
|
|
|
$this->assertTrue($agency->save(), 'agency-cant-save'); |
46
|
|
|
$this->assertTrue($agency->delete(), 'agency-cant-delete'); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
protected function tearDown() |
50
|
|
|
{ |
51
|
|
|
$this->logErrors(); |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
|