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
|
|
|
|
20
|
|
|
namespace FacturaScripts\Test\Core\Model; |
21
|
|
|
|
22
|
|
|
use FacturaScripts\Core\Model\GrupoClientes; |
23
|
|
|
use FacturaScripts\Test\Core\LogErrorsTrait; |
24
|
|
|
use PHPUnit\Framework\TestCase; |
25
|
|
|
|
26
|
|
|
final class GrupoClientesTest extends TestCase |
27
|
|
|
{ |
28
|
|
|
|
29
|
|
|
use LogErrorsTrait; |
30
|
|
|
|
31
|
|
|
public function testCreate() |
32
|
|
|
{ |
33
|
|
|
$group = new GrupoClientes(); |
34
|
|
|
$group->codgrupo = 'Test'; |
35
|
|
|
$group->nombre = 'Test Customer Group'; |
36
|
|
|
$this->assertTrue($group->save(), 'customer-group-cant-save'); |
37
|
|
|
$this->assertNotNull($group->primaryColumnValue(), 'customer-group-not-stored'); |
38
|
|
|
$this->assertTrue($group->exists(), 'customer-group-cant-persist'); |
39
|
|
|
$this->assertTrue($group->delete(), 'customer-group-cant-delete'); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function testCreateWithNoCode() |
43
|
|
|
{ |
44
|
|
|
$group = new GrupoClientes(); |
45
|
|
|
$group->nombre = 'Test Customer Group'; |
46
|
|
|
$this->assertTrue($group->save(), 'customer-group-cant-save'); |
47
|
|
|
$this->assertTrue($group->delete(), 'customer-group-cant-delete'); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
protected function tearDown() |
51
|
|
|
{ |
52
|
|
|
$this->logErrors(); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|