summaryrefslogtreecommitdiff
path: root/tests/feature/EmbeddedVariablesTest.php
blob: d17793f341a6cd8918707368afa756bc100dd50c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
/**
 * webtrees: online genealogy
 * Copyright (C) 2019 webtrees development team
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
declare(strict_types=1);

namespace Fisharebest\Webtrees;

use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Services\UserService;

/**
 * Test the user functions
 *
 * @covers \Fisharebest\Webtrees\Statistics
 * @covers \Fisharebest\Webtrees\Statistics\Repository\BrowserRepository
 * @covers \Fisharebest\Webtrees\Statistics\Repository\ServerRepository
 * @covers \Fisharebest\Webtrees\Statistics\Repository\LatestUserRepository
 * @covers \Fisharebest\Webtrees\Statistics\Repository\FamilyDatesRepository
 * @covers \Fisharebest\Webtrees\Statistics\Repository\HitCountRepository
 * @covers \Fisharebest\Webtrees\Statistics\Repository\NewsRepository
 * @covers \Fisharebest\Webtrees\Statistics\Repository\FavoritesRepository
 * @covers \Fisharebest\Webtrees\Statistics\Repository\IndividualRepository
 * @covers \Fisharebest\Webtrees\Statistics\Repository\MediaRepository
 * @covers \Fisharebest\Webtrees\Statistics\Repository\MessageRepository
 * @covers \Fisharebest\Webtrees\Statistics\Repository\ContactRepository
 * @covers \Fisharebest\Webtrees\Statistics\Repository\GedcomRepository
 * @covers \Fisharebest\Webtrees\Statistics\Repository\FamilyRepository
 * @covers \Fisharebest\Webtrees\Statistics\Repository\EventRepository
 * @covers \Fisharebest\Webtrees\Statistics\Repository\PlaceRepository
 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\MediaRepositoryInterface
 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\MessageRepositoryInterface
 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\HitCountRepositoryInterface
 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\FavoritesRepositoryInterface
 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\GedcomRepositoryInterface
 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\EventRepositoryInterface
 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\UserRepositoryInterface
 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\PlaceRepositoryInterface
 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\IndividualRepositoryInterface
 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\NewsRepositoryInterface
 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\FamilyDatesRepositoryInterface
 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\ContactRepositoryInterface
 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\ServerRepositoryInterface
 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\BrowserRepositoryInterface
 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\LatestUserRepositoryInterface
 * @covers \Fisharebest\Webtrees\Statistics\Repository\UserRepository
 * @covers \Fisharebest\Webtrees\Statistics\AbstractGoogle
 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartChildren
 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartAge
 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartCommonGiven
 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartMarriageAge
 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartCommonSurname
 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartDistribution
 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartFamilyLargest
 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartNoChildrenFamilies
 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartSex
 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartMedia
 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartMarriage
 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartFamilyWithSources
 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartMortality
 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartDeath
 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartIndividualWithSources
 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartBirth
 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartDivorce
 * @covers \Fisharebest\Webtrees\Statistics\Helper\Country
 * @covers \Fisharebest\Webtrees\Statistics\Helper\Century
 */
class EmbeddedVariablesTest extends TestCase
{
    protected static $uses_database = true;

    /**
     * @return void
     */
    public function testAllEmbeddedVariables(): void
    {
        global $tree; // For Date::display()

        $tree       = $this->importTree('demo.ged');
        $statistics = new Statistics(new ModuleService(), $tree, new UserService());

        $text = $statistics->embedTags('#getAllTagsTable#');

        $this->assertNotEquals('#getAllTagsTable#', $text);
    }

    /**
     * @return void
     */
    public function testAllEmbeddedVariablesWithEmptyTree(): void
    {
        global $tree; // For Date::display()

        $tree = Tree::create('name', 'title');
        $tree->deleteGenealogyData(false);
        $statistics = new Statistics(new ModuleService(), $tree, new UserService());

        $text = $statistics->embedTags('#getAllTagsTable#');

        $this->assertNotEquals('#getAllTagsTable#', $text);
    }
}