xref: /webtrees/tests/feature/EmbeddedVariablesTest.php (revision 4a52049613a3fd380896a97f74b94d45ccccc97c)
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
20e5a6b4d4SGreg Roachuse Fisharebest\Webtrees\Services\ModuleService;
21e5a6b4d4SGreg Roachuse Fisharebest\Webtrees\Services\UserService;
22e5a6b4d4SGreg Roach
23fd9aba47SGreg Roach/**
24fd9aba47SGreg Roach * Test the user functions
25fd9aba47SGreg Roach */
26e5a6b4d4SGreg Roachclass EmbeddedVariablesTest extends TestCase
27fd9aba47SGreg Roach{
28fd9aba47SGreg Roach    protected static $uses_database = true;
29fd9aba47SGreg Roach
30fd9aba47SGreg Roach    /**
31fd9aba47SGreg Roach     * @return void
32fd9aba47SGreg Roach     */
33e5a6b4d4SGreg Roach    public function testAllEmbeddedVariables(): void
34fd9aba47SGreg Roach    {
35e5a6b4d4SGreg Roach        global $tree; // For Date::display()
36e5a6b4d4SGreg Roach
37fd9aba47SGreg Roach        $tree = $this->importTree('demo.ged');
38e5a6b4d4SGreg Roach        $statistics = new Statistics(new ModuleService(), $tree, new UserService());
39e5a6b4d4SGreg Roach
40*4a520496SGreg Roach        $text = $statistics->embedTags('#getAllTagsTable#');
41e5a6b4d4SGreg Roach
42*4a520496SGreg Roach        $this->assertNotEquals('#getAllTagsTable#', $text);
43e5a6b4d4SGreg Roach    }
44e5a6b4d4SGreg Roach
45e5a6b4d4SGreg Roach    /**
46e5a6b4d4SGreg Roach     * @return void
47e5a6b4d4SGreg Roach     */
48e5a6b4d4SGreg Roach    public function testAllEmbeddedVariablesWithEmptyTree(): void
49e5a6b4d4SGreg Roach    {
50e5a6b4d4SGreg Roach        global $tree; // For Date::display()
51e5a6b4d4SGreg Roach
52e5a6b4d4SGreg Roach        $tree = Tree::create('name', 'title');
53e5a6b4d4SGreg Roach        $tree->deleteGenealogyData(false);
54e5a6b4d4SGreg Roach        $statistics = new Statistics(new ModuleService(), $tree, new UserService());
55e5a6b4d4SGreg Roach
56*4a520496SGreg Roach        $text = $statistics->embedTags('#getAllTagsTable#');
57e5a6b4d4SGreg Roach
58*4a520496SGreg Roach        $this->assertNotEquals('#getAllTagsTable#', $text);
59fd9aba47SGreg Roach    }
60fd9aba47SGreg Roach}
61