1<?php 2 3//this has to be set up to right path 4require_once DOKU_INC . 'lib/plugins/latexit/classes/RowspanHandler.php'; 5 6/** 7 * RowspanHandler tests for the latexit plugin 8 * 9 * @group plugin_latexit_classes 10 * @group plugin_latexit 11 * @group plugins 12 */ 13class rowspanhandler_plugin_latexit_test extends DokuWikiTest { 14 15 /** 16 * These plugins will be loaded for testing. 17 * @var array 18 */ 19 protected $pluginsEnabled = array('latexit', 'mathjax', 'imagereference', 'zotero'); 20 21 /** 22 * Variable to store the instance of the Rowspan Handler. 23 * @var RowspanHandler 24 */ 25 protected $r; 26 27 /** 28 * Prepares the testing environment. 29 */ 30 public function setUp() { 31 parent::setUp(); 32 $this->r = new RowspanHandler(); 33 } 34 35 /** 36 * Testing getRowspan method. 37 */ 38 public function test_getRowspan() { 39 $this->r->insertRowspan(6, 3); 40 $this->assertEquals(6, $this->r->getRowspan(3)); 41 //this rowspan does not exist => should return 0 42 $this->assertEquals(0, $this->r->getRowspan(1)); 43 } 44 45 /** 46 * Testing decreaseRowspan method. 47 */ 48 public function test_decreaseRowspan() { 49 $this->r->insertRowspan(6, 3); 50 $this->r->decreaseRowspan(3); 51 $this->assertEquals(5, $this->r->getRowspan(3)); 52 53 $this->r->insertRowspan(1, 2); 54 $this->assertEquals(1, $this->r->getRowspan(2)); 55 $this->r->decreaseRowspan(2); 56 //Rowspan does not exist anymore now. 57 $this->assertEquals(0, $this->r->getRowspan(2)); 58 } 59 60} 61