1*32ff69b6SAndreas Gohr<?php 2*32ff69b6SAndreas Gohr 3*32ff69b6SAndreas Gohrnamespace dokuwiki\plugin\dw2pdf\test; 4*32ff69b6SAndreas Gohr 5*32ff69b6SAndreas Gohruse DokuWikiTest; 6*32ff69b6SAndreas Gohr 7*32ff69b6SAndreas Gohr/** 8*32ff69b6SAndreas Gohr * Class dw2pdf_renderer_dw2pdf_test 9*32ff69b6SAndreas Gohr * 10*32ff69b6SAndreas Gohr * @group plugin_dw2pdf 11*32ff69b6SAndreas Gohr * @group plugins 12*32ff69b6SAndreas Gohr */ 13*32ff69b6SAndreas Gohrclass RendererTest extends DokuWikiTest { 14*32ff69b6SAndreas Gohr 15*32ff69b6SAndreas Gohr public function test() { 16*32ff69b6SAndreas Gohr $Renderer = new \renderer_plugin_dw2pdf(); 17*32ff69b6SAndreas Gohr 18*32ff69b6SAndreas Gohr $levels = [ 19*32ff69b6SAndreas Gohr 1,2,2,2,3,4,5,6,5,4,3,2,1, // index:0-12 20*32ff69b6SAndreas Gohr 3,4,3,1, // 13-16 21*32ff69b6SAndreas Gohr 2,3,4,2,3,4,1, // 17-23 22*32ff69b6SAndreas Gohr 3,4,3,2,1, // 24-28 23*32ff69b6SAndreas Gohr 3,4,2,1, // 29-32 24*32ff69b6SAndreas Gohr 3,5,6,5,6,4,6,3,1, // 33-41 25*32ff69b6SAndreas Gohr 3,6,4,5,6,4,3,6,2,1, // 42-51 26*32ff69b6SAndreas Gohr 2,3,2,3,3 // 52-56 27*32ff69b6SAndreas Gohr ]; 28*32ff69b6SAndreas Gohr $expectedbookmarklevels = [ 29*32ff69b6SAndreas Gohr 0,1,1,1,2,3,4,5,4,3,2,1,0, 30*32ff69b6SAndreas Gohr 1,2,1,0, 31*32ff69b6SAndreas Gohr 1,2,3,1,2,3,0, 32*32ff69b6SAndreas Gohr 1,2,1,1,0, 33*32ff69b6SAndreas Gohr 1,2,1,0, 34*32ff69b6SAndreas Gohr 1,2,3,2,3,2,3,2,0, 35*32ff69b6SAndreas Gohr 1,2,2,3,4,2,2,3,1,0, 36*32ff69b6SAndreas Gohr 1,2,1,2,2 37*32ff69b6SAndreas Gohr ]; 38*32ff69b6SAndreas Gohr foreach ($levels as $i => $level) { 39*32ff69b6SAndreas Gohr $actualbookmarklevel = $this->callInaccessibleMethod($Renderer, 'calculateBookmarklevel', [$level]); 40*32ff69b6SAndreas Gohr $this->assertEquals($expectedbookmarklevels[$i], $actualbookmarklevel, "index:$i, lvl:$level"); 41*32ff69b6SAndreas Gohr } 42*32ff69b6SAndreas Gohr } 43*32ff69b6SAndreas Gohr} 44