Skip to content

Commit

Permalink
Merge pull request #240 from annda/gh-tests
Browse files Browse the repository at this point in the history
Update tests
  • Loading branch information
splitbrain committed Feb 1, 2024
2 parents 01578b9 + 820f7b6 commit 957fa14
Show file tree
Hide file tree
Showing 23 changed files with 759 additions and 718 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/dokuwiki.yml
@@ -0,0 +1,11 @@
name: DokuWiki Default Tasks
on:
push:
pull_request:
schedule:
- cron: '16 8 25 * *'


jobs:
all:
uses: dokuwiki/github-action/.github/workflows/all.yml@main
52 changes: 0 additions & 52 deletions .github/workflows/phpTestLinux.yml

This file was deleted.

8 changes: 4 additions & 4 deletions Form/DropdownElement.php
Expand Up @@ -2,6 +2,7 @@

namespace dokuwiki\plugin\data\Form;

use dokuwiki\Form\InputElement;
use dokuwiki\Form\OptGroup;

/**
Expand All @@ -14,7 +15,7 @@ class DropdownElement extends \dokuwiki\Form\DropdownElement
protected $values = [];

/** @var \dokuwiki\plugin\data\Form\OptGroup[] */
protected $optGroups = array();
protected $optGroups = [];


/**
Expand All @@ -27,7 +28,7 @@ class DropdownElement extends \dokuwiki\Form\DropdownElement
*/
public function __construct($name, $options, $label = '')
{
\dokuwiki\Form\InputElement::__construct('dropdown', $name, $label);
InputElement::__construct('dropdown', $name, $label);
$this->rmattr('type');
$this->optGroups[''] = new \dokuwiki\plugin\data\Form\OptGroup(null, $options);
$this->val('');
Expand Down Expand Up @@ -69,7 +70,7 @@ public function val($value = null)
*/
public function attr($name, $value = null)
{
return \dokuwiki\Form\InputElement::attr($name, $value);
return InputElement::attr($name, $value);
}

/**
Expand Down Expand Up @@ -143,5 +144,4 @@ function ($html, OptGroup $optGroup) {

return $html;
}

}
4 changes: 2 additions & 2 deletions _test/action_edit_button.test.php
Expand Up @@ -16,7 +16,7 @@ function testSetName()
'target' => 'plugin_data'
);
$event = new Doku_Event('', $data);
$action->_editbutton($event, null);
$action->editButton($event, null);

$this->assertTrue(isset($data['name']));
}
Expand All @@ -28,7 +28,7 @@ function testWrongTarget()
'target' => 'default target'
);
$event = new Doku_Event('', $data);
$action->_editbutton($event, null);
$action->editButton($event, null);

$this->assertFalse(isset($data['name']));
}
Expand Down
11 changes: 5 additions & 6 deletions _test/action_handle.test.php
Expand Up @@ -8,7 +8,6 @@
*/
class action_handle_test extends DokuWikiTest
{

protected $pluginsEnabled = array('data', 'sqlite');

protected $action;
Expand All @@ -30,15 +29,15 @@ public function setUp(): void

$this->action = new action_plugin_data();
$this->helper = plugin_load('helper', 'data');
$this->db = $this->helper->_getDB();
$this->db = $this->helper->getDB();

$this->db->exec(
'INSERT INTO pages ( pid, page, title , class , lastmod) VALUES (?, ?, ?, ?, ?)',
[1, 'test', 'title', 'class', time()]
);
}

function testHandleStillPresent()
public function testHandleStillPresent()
{

$data = array(
Expand All @@ -49,13 +48,13 @@ function testHandleStillPresent()
2 => 'test'
);
$event = new Doku_Event('', $data);
$this->action->_handle($event, null);
$this->action->handle($event, null);

$pid = $this->getTestPageId();
$this->assertFalse(!$pid);
}

function testHandleDelete()
public function testHandleDelete()
{
$data = array(
0 => array(
Expand All @@ -66,7 +65,7 @@ function testHandleDelete()
);

$event = new Doku_Event('', $data);
$this->action->_handle($event, null);
$this->action->handle($event, null);

$pid = $this->db->queryValue('SELECT pid FROM pages WHERE page = ?', 'test');
$this->assertTrue(!$pid);
Expand Down

0 comments on commit 957fa14

Please sign in to comment.