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 * \Fisharebest\Webtrees\Statistics\Repository\BrowserRepository 26 * \Fisharebest\Webtrees\Statistics\Repository\ServerRepository 27 * \Fisharebest\Webtrees\Statistics\Repository\LatestUserRepository 28 * \Fisharebest\Webtrees\Statistics\Repository\FamilyDatesRepository 29 * \Fisharebest\Webtrees\Statistics\Repository\HitCountRepository 30 * \Fisharebest\Webtrees\Statistics\Repository\NewsRepository 31 * \Fisharebest\Webtrees\Statistics\Repository\FavoritesRepository 32 * \Fisharebest\Webtrees\Statistics\Repository\IndividualRepository 33 * \Fisharebest\Webtrees\Statistics\Repository\MediaRepository 34 * \Fisharebest\Webtrees\Statistics\Repository\MessageRepository 35 * \Fisharebest\Webtrees\Statistics\Repository\ContactRepository 36 * \Fisharebest\Webtrees\Statistics\Repository\GedcomRepository 37 * \Fisharebest\Webtrees\Statistics\Repository\FamilyRepository 38 * \Fisharebest\Webtrees\Statistics\Repository\EventRepository 39 * \Fisharebest\Webtrees\Statistics\Repository\PlaceRepository 40 * \Fisharebest\Webtrees\Statistics\Repository\Interfaces\MediaRepositoryInterface 41 * \Fisharebest\Webtrees\Statistics\Repository\Interfaces\MessageRepositoryInterface 42 * \Fisharebest\Webtrees\Statistics\Repository\Interfaces\HitCountRepositoryInterface 43 * \Fisharebest\Webtrees\Statistics\Repository\Interfaces\FavoritesRepositoryInterface 44 * \Fisharebest\Webtrees\Statistics\Repository\Interfaces\GedcomRepositoryInterface 45 * \Fisharebest\Webtrees\Statistics\Repository\Interfaces\EventRepositoryInterface 46 * \Fisharebest\Webtrees\Statistics\Repository\Interfaces\UserRepositoryInterface 47 * \Fisharebest\Webtrees\Statistics\Repository\Interfaces\PlaceRepositoryInterface 48 * \Fisharebest\Webtrees\Statistics\Repository\Interfaces\IndividualRepositoryInterface 49 * \Fisharebest\Webtrees\Statistics\Repository\Interfaces\NewsRepositoryInterface 50 * \Fisharebest\Webtrees\Statistics\Repository\Interfaces\FamilyDatesRepositoryInterface 51 * \Fisharebest\Webtrees\Statistics\Repository\Interfaces\ContactRepositoryInterface 52 * \Fisharebest\Webtrees\Statistics\Repository\Interfaces\ServerRepositoryInterface 53 * \Fisharebest\Webtrees\Statistics\Repository\Interfaces\BrowserRepositoryInterface 54 * \Fisharebest\Webtrees\Statistics\Repository\Interfaces\LatestUserRepositoryInterface 55 * \Fisharebest\Webtrees\Statistics\Repository\UserRepository 56 * \Fisharebest\Webtrees\Statistics\AbstractGoogle 57 * \Fisharebest\Webtrees\Statistics\Google\ChartChildren 58 * \Fisharebest\Webtrees\Statistics\Google\ChartAge 59 * \Fisharebest\Webtrees\Statistics\Google\ChartCommonGiven 60 * \Fisharebest\Webtrees\Statistics\Google\ChartMarriageAge 61 * \Fisharebest\Webtrees\Statistics\Google\ChartCommonSurname 62 * \Fisharebest\Webtrees\Statistics\Google\ChartDistribution 63 * \Fisharebest\Webtrees\Statistics\Google\ChartFamilyLargest 64 * \Fisharebest\Webtrees\Statistics\Google\ChartNoChildrenFamilies 65 * \Fisharebest\Webtrees\Statistics\Google\ChartSex 66 * \Fisharebest\Webtrees\Statistics\Google\ChartMedia 67 * \Fisharebest\Webtrees\Statistics\Google\ChartMarriage 68 * \Fisharebest\Webtrees\Statistics\Google\ChartFamilyWithSources 69 * \Fisharebest\Webtrees\Statistics\Google\ChartMortality 70 * \Fisharebest\Webtrees\Statistics\Google\ChartDeath 71 * \Fisharebest\Webtrees\Statistics\Google\ChartIndividualWithSources 72 * \Fisharebest\Webtrees\Statistics\Google\ChartBirth 73 * \Fisharebest\Webtrees\Statistics\Google\ChartDivorce 74 * \Fisharebest\Webtrees\Statistics\Helper\Country 75 * \Fisharebest\Webtrees\Statistics\Helper\Century 76 */ 77 78class EmbeddedVariablesTest extends TestCase 79{ 80 protected static $uses_database = true; 81 82 /** 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 * @return void 99 */ 100 public function testAllEmbeddedVariablesWithEmptyTree(): void 101 { 102 global $tree; // For Date::display() 103 104 $tree = Tree::create('name', 'title'); 105 $tree->deleteGenealogyData(false); 106 $statistics = new Statistics(new ModuleService(), $tree, new UserService()); 107 108 $text = $statistics->embedTags('#getAllTagsTable#'); 109 110 $this->assertNotEquals('#getAllTagsTable#', $text); 111 } 112} 113