1<?php 2/** 3 * @group plugin_multiselect 4 * @group plugins 5 */ 6class plugin_multiselect_syntax_test extends DokuWikiTest { 7 8 public function setup() { 9 $this->pluginsEnabled[] = 'multiselect'; 10 $this->pluginsEnabled[] = 'ajaxedit'; 11 parent::setup(); 12 } 13 14 15 public function test_basic_syntax() { 16 global $INFO; 17 $INFO['id'] = 'test:plugin_multiselect:syntax'; 18 saveWikiText('test:plugin_multiselect:syntax','<multiselect a b c d>','test'); 19 20 $xhtml = p_wiki_xhtml('test:plugin_multiselect:syntax'); 21 22 $doc = phpQuery::newDocument($xhtml); 23 24 $mselector = pq("span.multiselector",$doc); 25 $this->assertTrue($mselector->length === 1); 26 $this->assertTrue(pq("span",$mselector)->length === 4); 27 $this->assertEquals('a',trim(pq("span",$mselector)->eq(0)->text())); 28 $this->assertEquals('b',trim(pq("span",$mselector)->eq(1)->text())); 29 $this->assertEquals('c',trim(pq("span",$mselector)->eq(2)->text())); 30 $this->assertEquals('d',trim(pq("span",$mselector)->eq(3)->text())); 31 32 $this->assertEquals('a',trim(pq("span.multismiley",$doc)->text())); 33 34 } 35 36 public function test_basic2_syntax() { 37 global $INFO; 38 $INFO['id'] = 'test:plugin_multiselect:syntax2'; 39 saveWikiText('test:plugin_multiselect:syntax2','<multiselect "a a" "üöäß" ä_ :-)>','test'); 40 41 $xhtml = p_wiki_xhtml('test:plugin_multiselect:syntax2'); 42 //echo $xhtml; 43 $doc = phpQuery::newDocument($xhtml); 44 45 $mselector = pq("span.multiselector",$doc); 46 $this->assertTrue($mselector->length === 1); 47 $this->assertTrue(pq("span",$mselector)->length === 4); 48 $this->assertEquals('a a',trim(pq("span",$mselector)->eq(0)->text())); 49 $this->assertEquals('üöäß',trim(pq("span",$mselector)->eq(1)->text())); 50 $this->assertEquals('ä_',trim(pq("span",$mselector)->eq(2)->text())); 51 $this->assertEquals(':-)',trim(pq('img',pq("span",$mselector)->eq(3))->attr('alt'))); 52 53 $this->assertEquals('a a',trim(pq("span.multismiley",$doc)->text())); 54 55 } 56} 57