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