1<?php 2 3namespace dokuwiki\plugin\extension\test; 4 5use dokuwiki\plugin\extension\Extension; 6use dokuwiki\plugin\extension\Notice; 7use DokuWikiTest; 8 9/** 10 * Tests for the notice generation of the extension plugin 11 * 12 * @group plugin_extension 13 * @group plugins 14 */ 15class NoticeTest extends DokuWikiTest 16{ 17 protected $pluginsEnabled = ['extension']; 18 19 /** 20 * A malformed conflict id in the repository metadata must not crash the notice generation 21 * 22 * Extension authors may enter free form text like "sprintdoc template" in the conflicts 23 * field. Such values are not valid extension ids and must be skipped silently. 24 */ 25 public function testMalformedConflictIsIgnored() 26 { 27 $extension = Extension::createFromRemoteData([ 28 'plugin' => 'plugin1', 29 'conflicts' => ['sprintdoc template'], 30 ]); 31 32 $notices = Notice::list($extension); 33 34 $this->assertIsArray($notices); 35 $this->assertEmpty($notices[Notice::WARNING]); 36 } 37 38 /** 39 * A malformed dependency id in the repository metadata must not crash the notice generation 40 */ 41 public function testMalformedDependencyIsIgnored() 42 { 43 // the extension plugin itself is installed, so the dependency check is not skipped 44 $extension = Extension::createFromRemoteData([ 45 'plugin' => 'extension', 46 'depends' => ['not:a:valid:id'], 47 ]); 48 49 $notices = Notice::list($extension); 50 51 $this->assertIsArray($notices); 52 $this->assertEmpty($notices[Notice::ERROR]); 53 } 54} 55