xref: /webtrees/tests/feature/EmbeddedVariablesTest.php (revision e5a6b4d4f6f6e7ff2fba7ae2cf27546ae68a79cc)
1fd9aba47SGreg Roach<?php
2fd9aba47SGreg Roach/**
3fd9aba47SGreg Roach * webtrees: online genealogy
4fd9aba47SGreg Roach * Copyright (C) 2019 webtrees development team
5fd9aba47SGreg Roach * This program is free software: you can redistribute it and/or modify
6fd9aba47SGreg Roach * it under the terms of the GNU General Public License as published by
7fd9aba47SGreg Roach * the Free Software Foundation, either version 3 of the License, or
8fd9aba47SGreg Roach * (at your option) any later version.
9fd9aba47SGreg Roach * This program is distributed in the hope that it will be useful,
10fd9aba47SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
11fd9aba47SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12fd9aba47SGreg Roach * GNU General Public License for more details.
13fd9aba47SGreg Roach * You should have received a copy of the GNU General Public License
14fd9aba47SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
15fd9aba47SGreg Roach */
16fd9aba47SGreg Roachdeclare(strict_types=1);
17fd9aba47SGreg Roach
18fd9aba47SGreg Roachnamespace Fisharebest\Webtrees;
19fd9aba47SGreg Roach
20*e5a6b4d4SGreg Roachuse Fisharebest\Webtrees\Services\ModuleService;
21*e5a6b4d4SGreg Roachuse Fisharebest\Webtrees\Services\UserService;
22*e5a6b4d4SGreg Roach
23fd9aba47SGreg Roach/**
24fd9aba47SGreg Roach * Test the user functions
25fd9aba47SGreg Roach *
26fd9aba47SGreg Roach * @coversNothing
27fd9aba47SGreg Roach */
28*e5a6b4d4SGreg Roachclass EmbeddedVariablesTest extends TestCase
29fd9aba47SGreg Roach{
30fd9aba47SGreg Roach    protected static $uses_database = true;
31fd9aba47SGreg Roach
32fd9aba47SGreg Roach    /**
33fd9aba47SGreg Roach     * @return void
34fd9aba47SGreg Roach     */
35*e5a6b4d4SGreg Roach    public function testAllEmbeddedVariables(): void
36fd9aba47SGreg Roach    {
37*e5a6b4d4SGreg Roach        global $tree; // For Date::display()
38*e5a6b4d4SGreg Roach
39fd9aba47SGreg Roach        $tree = $this->importTree('demo.ged');
40fd9aba47SGreg Roach
41*e5a6b4d4SGreg Roach        $statistics = new Statistics(new ModuleService(), $tree, new UserService());
42*e5a6b4d4SGreg Roach
43*e5a6b4d4SGreg Roach        $text = $statistics->embedTags('#getAllTagsTable#');
44*e5a6b4d4SGreg Roach
45*e5a6b4d4SGreg Roach        $this->assertNotEquals('#getAllTagsTable#', $text);
46*e5a6b4d4SGreg Roach    }
47*e5a6b4d4SGreg Roach
48*e5a6b4d4SGreg Roach    /**
49*e5a6b4d4SGreg Roach     * @return void
50*e5a6b4d4SGreg Roach     */
51*e5a6b4d4SGreg Roach    public function testAllEmbeddedVariablesWithEmptyTree(): void
52*e5a6b4d4SGreg Roach    {
53*e5a6b4d4SGreg Roach        global $tree; // For Date::display()
54*e5a6b4d4SGreg Roach
55*e5a6b4d4SGreg Roach        $tree = Tree::create('name', 'title');
56*e5a6b4d4SGreg Roach        $tree->deleteGenealogyData(false);
57*e5a6b4d4SGreg Roach
58*e5a6b4d4SGreg Roach        $statistics = new Statistics(new ModuleService(), $tree, new UserService());
59*e5a6b4d4SGreg Roach
60*e5a6b4d4SGreg Roach        $text = $statistics->embedTags('#getAllTagsTable#');
61*e5a6b4d4SGreg Roach
62*e5a6b4d4SGreg Roach        $this->assertNotEquals('#getAllTagsTable#', $text);
63fd9aba47SGreg Roach    }
64fd9aba47SGreg Roach}
65