]>
git.agnieray.net Git - galette.git/blob - tests/Galette/Core/tests/units/CheckModules.php
2959764d5b11c3b5a2af1d18f45d7fc7737727d2
3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
10 * Copyright © 2016-2023 The Galette Team
12 * This file is part of Galette (http://galette.tuxfamily.org).
14 * Galette is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
19 * Galette is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
28 * @package GaletteTests
30 * @author Johan Cwiklinski <johan@x-tnd.be>
31 * @copyright 2016-2023 The Galette Team
32 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
34 * @link http://galette.tuxfamily.org
38 namespace Galette\Core\test\units
;
43 * CheckModules tests class
47 * @package GaletteTests
48 * @author Johan Cwiklinski <johan@x-tnd.be>
49 * @copyright 2016-2023 The Galette Team
50 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
51 * @link http://galette.tuxfamily.org
54 class CheckModules
extends atoum
59 * @param string $method Calling method
63 public function afterTestMethod($method)
65 if (TYPE_DB
=== 'mysql') {
66 $zdb = new \Galette\Core\
Db();
67 $this->array($zdb->getWarnings())->isIdenticalTo([]);
72 * Test modules, all should be ok
76 public function testAllOK()
78 $checks = new \Galette\Core\
CheckModules();
79 $this->boolean($checks->isValid())->isTrue();
80 $this->integer(count($checks->getGoods()))
81 ->isLessThanOrEqualTo(10)
82 ->isGreaterThanOrEqualTo(6);
83 $this->array($checks->getMissings())
85 $this->array($checks->getShoulds())
87 $this->boolean($checks->isGood('mbstring'))
92 * Test all extensions missing
96 public function testAllKO()
98 $this->assert('All PHP extensions missing')
99 ->given($checks = new \Galette\Core\
CheckModules(false))
100 ->if($this->function->extension_loaded
= false)
102 ->if($checks->doCheck())
104 ->array($checks->getGoods())
106 ->array($checks->getShoulds())
108 ->array($checks->getMissings())
110 ->string($checks->toHtml())
111 ->notContains('green check icon')
120 public function testToHtml()
122 $checks = new \Galette\Core\
CheckModules();
124 $html = $checks->toHtml();
126 ->notContains('icon-invalid.png')
127 ->length
->isGreaterThanOrEqualTo(908);