Skip to content

Commit

Permalink
Merge pull request #209 from LarsGit223/master
Browse files Browse the repository at this point in the history
Minor changes to improve tests.
  • Loading branch information
michitux committed May 25, 2017
2 parents 6cfb597 + dbb479d commit 71b2397
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
40 changes: 36 additions & 4 deletions _test/namespace_includes.test.php
Expand Up @@ -41,6 +41,25 @@ public function setup() {
saveWikiText('inclorder:page4', '{{include_n>2}} Page 4/2', 'created page 4/0');
}

/**
* Helper function to read dir content
*/
protected function getDirContent ($dir) {
if (is_dir($dir)) {
$pages = array();
if ($handle = opendir($dir)) {
while (($file = readdir($handle)) !== false) {
if ($file != '.' && $file != '..') {
$pages [] = $file;
}
}
closedir($handle);
return $pages;
}
}
return null;
}

/**
* Test hiding of hidden pages in namespace includes
*/
Expand Down Expand Up @@ -87,17 +106,30 @@ public function test_depth() {
$this->assertEquals(array(array('id' => 'mailinglist', 'exists' => true, 'parent_id' => '')), $pages);
$flags = $this->helper->get_flags(array('depth=2'));
$pages = $this->helper->_get_included_pages('namespace', ':', '', '', $flags);
$this->assertEquals(array(
$expected = array(
array('id' => 'inclhidden:visible', 'exists' => true, 'parent_id' => ''),
array('id' => 'inclorder:page1', 'exists' => true, 'parent_id' => ''),
array('id' => 'inclorder:page2', 'exists' => true, 'parent_id' => ''),
array('id' => 'inclorder:page3', 'exists' => true, 'parent_id' => ''),
array('id' => 'inclorder:page4', 'exists' => true, 'parent_id' => ''),
array('id' => 'incltest:level1', 'exists' => true, 'parent_id' => ''),
array('id' => 'mailinglist', 'exists' => true, 'parent_id' => ''),
array('id' => 'wiki:dokuwiki', 'exists' => true, 'parent_id' => ''),
array('id' => 'wiki:syntax', 'exists' => true, 'parent_id' => ''),
), $pages);
//array('id' => 'wiki:dokuwiki', 'exists' => true, 'parent_id' => ''),
//array('id' => 'wiki:syntax', 'exists' => true, 'parent_id' => ''),
//$wikiPages,
);

// Add pages in namespace wiki
$dir = $this->getDirContent(dirname(__FILE__).'/../../../../_test/data/pages/wiki');
$this->assertTrue($dir !== null);
foreach ($dir as $page) {
$page = substr($page, 0, -4);
$expected [] = array('id' => 'wiki:'.$page, 'exists' => true, 'parent_id' => '');
}

array_multisort($expected);
array_multisort($pages);
$this->assertEquals($expected, $pages);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lang/ar/lang.php
@@ -1,10 +1,10 @@
<?php
<?php
/**
* Arabic language file
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Muhammad Bashir Al-Noimi <bashir.storm@gmail.com>
* http://www.hali-sy.com
* http://www.hali-sy.com
*/

// custom language strings for the plugin
Expand Down
6 changes: 3 additions & 3 deletions lang/ar/settings.php
@@ -1,10 +1,10 @@
<?php
<?php
/**
* Arabic language file
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Muhammad Bashir Al-Noimi <bashir.storm@gmail.com>
* http://www.hali-sy.com
* http://www.hali-sy.com
*/

// for the configuration manager
Expand All @@ -17,4 +17,4 @@
$lang['showcomments'] = 'عرض تعليقات الصفحة المضمّنة';
$lang['showtags'] = 'عرض الأقسام أسف الصفحة المضمّنة';

//Setup VIM: ex: et ts=2 :
//Setup VIM: ex: et ts=2 :

0 comments on commit 71b2397

Please sign in to comment.