1<?php 2/** 3 * webtrees: online genealogy 4 * Copyright (C) 2019 webtrees development team 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * You should have received a copy of the GNU General Public License 14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 */ 16declare(strict_types=1); 17 18namespace Fisharebest\Webtrees; 19 20use Fisharebest\Webtrees\Services\ModuleService; 21use Fisharebest\Webtrees\Services\UserService; 22 23/** 24 * Test the user functions 25 */ 26class EmbeddedVariablesTest extends TestCase 27{ 28 protected static $uses_database = true; 29 30 /** 31 * @covers \Fisharebest\Webtrees\Statistics 32 * @covers \Fisharebest\Webtrees\Statistics\Repository\BrowserRepository 33 * @covers \Fisharebest\Webtrees\Statistics\Repository\ServerRepository 34 * @covers \Fisharebest\Webtrees\Statistics\Repository\LatestUserRepository 35 * @covers \Fisharebest\Webtrees\Statistics\Repository\FamilyDatesRepository 36 * @covers \Fisharebest\Webtrees\Statistics\Repository\HitCountRepository 37 * @covers \Fisharebest\Webtrees\Statistics\Repository\NewsRepository 38 * @covers \Fisharebest\Webtrees\Statistics\Repository\FavoritesRepository 39 * @covers \Fisharebest\Webtrees\Statistics\Repository\IndividualRepository 40 * @covers \Fisharebest\Webtrees\Statistics\Repository\MediaRepository 41 * @covers \Fisharebest\Webtrees\Statistics\Repository\MessageRepository 42 * @covers \Fisharebest\Webtrees\Statistics\Repository\ContactRepository 43 * @covers \Fisharebest\Webtrees\Statistics\Repository\GedcomRepository 44 * @covers \Fisharebest\Webtrees\Statistics\Repository\FamilyRepository 45 * @covers \Fisharebest\Webtrees\Statistics\Repository\EventRepository 46 * @covers \Fisharebest\Webtrees\Statistics\Repository\PlaceRepository 47 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\MediaRepositoryInterface 48 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\MessageRepositoryInterface 49 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\HitCountRepositoryInterface 50 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\FavoritesRepositoryInterface 51 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\GedcomRepositoryInterface 52 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\EventRepositoryInterface 53 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\UserRepositoryInterface 54 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\PlaceRepositoryInterface 55 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\IndividualRepositoryInterface 56 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\NewsRepositoryInterface 57 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\FamilyDatesRepositoryInterface 58 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\ContactRepositoryInterface 59 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\ServerRepositoryInterface 60 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\BrowserRepositoryInterface 61 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\LatestUserRepositoryInterface 62 * @covers \Fisharebest\Webtrees\Statistics\Repository\UserRepository 63 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartChildren 64 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartAge 65 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartCommonGiven 66 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartMarriageAge 67 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartCommonSurname 68 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartDistribution 69 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartFamilyLargest 70 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartNoChildrenFamilies 71 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartSex 72 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartMedia 73 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartMarriage 74 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartFamilyWithSources 75 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartMortality 76 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartDeath 77 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartIndividualWithSources 78 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartBirth 79 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartDivorce 80 * @covers \Fisharebest\Webtrees\Statistics\Service\CountryService 81 * @covers \Fisharebest\Webtrees\Statistics\Service\CenturyService 82 * @covers \Fisharebest\Webtrees\Statistics\Service\ColorService 83 * @return void 84 */ 85 public function testAllEmbeddedVariables(): void 86 { 87 global $tree; // For Date::display() 88 89 $tree = $this->importTree('demo.ged'); 90 $statistics = new Statistics(new ModuleService(), $tree, new UserService()); 91 92 $text = $statistics->embedTags('#getAllTagsTable#'); 93 94 $this->assertNotEquals('#getAllTagsTable#', $text); 95 } 96 97 /** 98 * @covers \Fisharebest\Webtrees\Statistics 99 * @covers \Fisharebest\Webtrees\Statistics\Repository\BrowserRepository 100 * @covers \Fisharebest\Webtrees\Statistics\Repository\ServerRepository 101 * @covers \Fisharebest\Webtrees\Statistics\Repository\LatestUserRepository 102 * @covers \Fisharebest\Webtrees\Statistics\Repository\FamilyDatesRepository 103 * @covers \Fisharebest\Webtrees\Statistics\Repository\HitCountRepository 104 * @covers \Fisharebest\Webtrees\Statistics\Repository\NewsRepository 105 * @covers \Fisharebest\Webtrees\Statistics\Repository\FavoritesRepository 106 * @covers \Fisharebest\Webtrees\Statistics\Repository\IndividualRepository 107 * @covers \Fisharebest\Webtrees\Statistics\Repository\MediaRepository 108 * @covers \Fisharebest\Webtrees\Statistics\Repository\MessageRepository 109 * @covers \Fisharebest\Webtrees\Statistics\Repository\ContactRepository 110 * @covers \Fisharebest\Webtrees\Statistics\Repository\GedcomRepository 111 * @covers \Fisharebest\Webtrees\Statistics\Repository\FamilyRepository 112 * @covers \Fisharebest\Webtrees\Statistics\Repository\EventRepository 113 * @covers \Fisharebest\Webtrees\Statistics\Repository\PlaceRepository 114 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\MediaRepositoryInterface 115 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\MessageRepositoryInterface 116 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\HitCountRepositoryInterface 117 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\FavoritesRepositoryInterface 118 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\GedcomRepositoryInterface 119 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\EventRepositoryInterface 120 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\UserRepositoryInterface 121 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\PlaceRepositoryInterface 122 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\IndividualRepositoryInterface 123 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\NewsRepositoryInterface 124 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\FamilyDatesRepositoryInterface 125 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\ContactRepositoryInterface 126 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\ServerRepositoryInterface 127 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\BrowserRepositoryInterface 128 * @covers \Fisharebest\Webtrees\Statistics\Repository\Interfaces\LatestUserRepositoryInterface 129 * @covers \Fisharebest\Webtrees\Statistics\Repository\UserRepository 130 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartChildren 131 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartAge 132 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartCommonGiven 133 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartMarriageAge 134 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartCommonSurname 135 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartDistribution 136 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartFamilyLargest 137 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartNoChildrenFamilies 138 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartSex 139 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartMedia 140 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartMarriage 141 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartFamilyWithSources 142 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartMortality 143 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartDeath 144 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartIndividualWithSources 145 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartBirth 146 * @covers \Fisharebest\Webtrees\Statistics\Google\ChartDivorce 147 * @covers \Fisharebest\Webtrees\Statistics\Service\CountryService 148 * @covers \Fisharebest\Webtrees\Statistics\Service\CenturyService 149 * @covers \Fisharebest\Webtrees\Statistics\Service\ColorService 150 * @return void 151 */ 152 public function testAllEmbeddedVariablesWithEmptyTree(): void 153 { 154 global $tree; // For Date::display() 155 156 $tree = Tree::create('name', 'title'); 157 $tree->deleteGenealogyData(false); 158 $statistics = new Statistics(new ModuleService(), $tree, new UserService()); 159 160 $text = $statistics->embedTags('#getAllTagsTable#'); 161 162 $this->assertNotEquals('#getAllTagsTable#', $text); 163 } 164} 165