]> git.agnieray.net Git - galette.git/blob - tests/Galette/Core/tests/units/Logo.php
bd6ebfba17d5f963fcd22c00edf1cbcb3b3957dd
[galette.git] / tests / Galette / Core / tests / units / Logo.php
1 <?php
2
3 /**
4 * Copyright © 2003-2024 The Galette Team
5 *
6 * This file is part of Galette (https://galette.eu).
7 *
8 * Galette is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * Galette is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 namespace Galette\Core\test\units;
23
24 use PHPUnit\Framework\TestCase;
25
26 /**
27 * Picture tests class
28 *
29 * @author Johan Cwiklinski <johan@x-tnd.be>
30 */
31 class Logo extends TestCase
32 {
33 private \Galette\Core\Db $zdb;
34
35 /**
36 * Set up tests
37 *
38 * @return void
39 */
40 public function setUp(): void
41 {
42 global $zdb;
43 $this->zdb = new \Galette\Core\Db();
44 $zdb = $this->zdb;
45 }
46
47 /**
48 * Tear down tests
49 *
50 * @return void
51 */
52 public function tearDown(): void
53 {
54 if (TYPE_DB === 'mysql') {
55 $this->assertSame($this->zdb->getWarnings(), []);
56 }
57 }
58
59 /**
60 * Test defaults after initialization
61 *
62 * @return void
63 */
64 public function testDefaults()
65 {
66 global $zdb;
67 $zdb = $this->zdb;
68 $expected_path = realpath(GALETTE_ROOT . 'webroot/themes/default/images/galette.png');
69
70 $instance = new \Galette\Core\Logo();
71 $this->assertNull($instance->getDestDir());
72 $this->assertNull($instance->getFileName());
73 $this->assertSame($expected_path, $instance->getPath());
74 $this->assertSame('image/png', $instance->getMime());
75 $this->assertSame('png', $instance->getFormat());
76 $this->assertFalse($instance->isCustom());
77 $this->assertSame(129, $instance->getOptimalWidth());
78 $this->assertSame(60, $instance->getOptimalHeight());
79 $this->assertSame(129, $instance->getWidth());
80 $this->assertSame(60, $instance->getHeight());
81 }
82 }