1<?php 2 3namespace dokuwiki\plugin\yearbox\test; 4 5use dokuwiki\plugin\yearbox\services\pageNameStrategies\PageNameStrategy; 6 7/** 8 * Tests from syntax to html for the yearbox plugin 9 * 10 * @group plugin_yearbox 11 * @group plugins 12 */ 13class pagenameStrategy_plugin_yearbox_test extends \DokuWikiTest { 14 15 16 public function dataProvider() 17 { 18 return [ 19 [ 20 '', 21 '', 22 'day', 23 ':2018-03:day-2018-03-08', 24 'Test default configutation', 25 ], 26 [ 27 'separatedCompletely', 28 'bar', 29 null, 30 'bar:2018:03:08', 31 'test completely separated namespaces' 32 ], 33 [ 34 'YearMonthSeperatedNS', 35 '', 36 '', 37 ':2018:03:2018-03-08', 38 'have year and month as separate ns, but keep the pageid the iso-date', 39 ], 40 [ 41 'YearNS', 42 'appreciation', 43 '', 44 'appreciation:2018:2018-03-08', 45 'have a year namespace and the iso-date as pade id' 46 ], 47 ]; 48 49 } 50 51 /** 52 * @dataProvider dataProvider 53 * 54 * @param string $strategyName 55 * @param string $baseNS 56 * @param string $name 57 * @param string $expectedPageId 58 * @param $msg 59 */ 60 public function test_pagenameStrategy($strategyName, $baseNS, $name, $expectedPageId, $msg) 61 { 62 $year = 2018; 63 $month = '03'; 64 $day = '08'; 65 66 $strategy = PageNameStrategy::getPagenameStategy($strategyName); 67 68 $actual_id = $strategy->getPageId($baseNS, $year, $month, $day, $name); 69 70 $this->assertSame($expectedPageId, $actual_id, $msg); 71 } 72} 73