mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 21:27:25 +02:00
Closes #3701 Plugin builder class moved to its own file. Default plugin icons are now created if an images/ folder is not found. Simple test added for detecting PHP notices etc. Some cleanup of generated code.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
2235
e107_handlers/e_pluginbuilder_class.php
Normal file
2235
e107_handlers/e_pluginbuilder_class.php
Normal file
File diff suppressed because it is too large
Load Diff
BIN
e107_plugins/_blank/images/icon_128.png
Normal file
BIN
e107_plugins/_blank/images/icon_128.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
BIN
e107_plugins/_blank/images/icon_16.png
Normal file
BIN
e107_plugins/_blank/images/icon_16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 857 B |
BIN
e107_plugins/_blank/images/icon_32.png
Normal file
BIN
e107_plugins/_blank/images/icon_32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
@@ -24,7 +24,7 @@
|
|||||||
}
|
}
|
||||||
catch(Exception $e)
|
catch(Exception $e)
|
||||||
{
|
{
|
||||||
$this->assertTrue(false, "Couldn't load UserHandler object");
|
$this->fail("Couldn't load UserHandler object");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
403
e107_tests/tests/unit/e_pluginbuilderTest.php
Normal file
403
e107_tests/tests/unit/e_pluginbuilderTest.php
Normal file
@@ -0,0 +1,403 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
class e_pluginbuilderTest extends \Codeception\Test\Unit
|
||||||
|
{
|
||||||
|
|
||||||
|
/** @var e_pluginbuilder */
|
||||||
|
protected $pb;
|
||||||
|
|
||||||
|
protected $posted;
|
||||||
|
|
||||||
|
protected function _before()
|
||||||
|
{
|
||||||
|
require_once(e_HANDLER."e_pluginbuilder_class.php");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$this->pb = $this->make('e_pluginbuilder');
|
||||||
|
}
|
||||||
|
|
||||||
|
catch(Exception $e)
|
||||||
|
{
|
||||||
|
$this->fail($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->posted = array (
|
||||||
|
'xml' =>
|
||||||
|
array (
|
||||||
|
'main-name' => 'Test',
|
||||||
|
'main-lang' => '',
|
||||||
|
'main-version' => '1.0',
|
||||||
|
'main-date' => '2022-12-12',
|
||||||
|
'main-compatibility' => '2.0',
|
||||||
|
'author-name' => 'admin',
|
||||||
|
'author-url' => 'https://e107.org',
|
||||||
|
'summary-summary' => 'Test Plugin Creation',
|
||||||
|
'description-description' => 'Example of a plugin description',
|
||||||
|
'keywords-one' => 'generic',
|
||||||
|
'keywords-two' => 'test',
|
||||||
|
'keywords-three' => 'unit',
|
||||||
|
'category-category' => 'content',
|
||||||
|
'copyright-copyright' => 'copyright info',
|
||||||
|
),
|
||||||
|
'example_ui' =>
|
||||||
|
array (
|
||||||
|
'pluginName' => 'ExamplePlugin',
|
||||||
|
'table' => 'example',
|
||||||
|
'mode' => 'main',
|
||||||
|
'fields' =>
|
||||||
|
array (
|
||||||
|
'checkboxes' =>
|
||||||
|
array (
|
||||||
|
'title' => '',
|
||||||
|
'type' => '',
|
||||||
|
'data' => '',
|
||||||
|
'width' => '5%',
|
||||||
|
'thclass' => 'center',
|
||||||
|
'forced' => 'value',
|
||||||
|
'class' => 'center',
|
||||||
|
'toggle' => 'e-multiselect',
|
||||||
|
'fieldpref' => 'value',
|
||||||
|
),
|
||||||
|
'example_id' =>
|
||||||
|
array (
|
||||||
|
'title' => 'LAN_ID',
|
||||||
|
'type' => 'number',
|
||||||
|
'data' => 'int',
|
||||||
|
'width' => '5%',
|
||||||
|
'help' => '',
|
||||||
|
'readParms' => '',
|
||||||
|
'writeParms' => '',
|
||||||
|
'class' => 'left',
|
||||||
|
'thclass' => 'left',
|
||||||
|
),
|
||||||
|
'example_icon' =>
|
||||||
|
array (
|
||||||
|
'title' => 'LAN_ICON',
|
||||||
|
'type' => 'icon',
|
||||||
|
'data' => 'safestr',
|
||||||
|
'width' => 'auto',
|
||||||
|
'help' => '',
|
||||||
|
'readParms' => '',
|
||||||
|
'writeParms' => '',
|
||||||
|
'class' => 'left',
|
||||||
|
'thclass' => 'left',
|
||||||
|
),
|
||||||
|
'example_type' =>
|
||||||
|
array (
|
||||||
|
'title' => 'LAN_TYPE',
|
||||||
|
'type' => 'dropdown',
|
||||||
|
'data' => 'safestr',
|
||||||
|
'width' => 'auto',
|
||||||
|
'batch' => '1',
|
||||||
|
'filter' => '1',
|
||||||
|
'inline' => '1',
|
||||||
|
'fieldpref' => '1',
|
||||||
|
'help' => '',
|
||||||
|
'readParms' => '',
|
||||||
|
'writeParms' => '',
|
||||||
|
'class' => 'left',
|
||||||
|
'thclass' => 'left',
|
||||||
|
),
|
||||||
|
'example_name' =>
|
||||||
|
array (
|
||||||
|
'title' => 'LAN_TITLE',
|
||||||
|
'type' => 'text',
|
||||||
|
'data' => 'safestr',
|
||||||
|
'width' => 'auto',
|
||||||
|
'inline' => '1',
|
||||||
|
'fieldpref' => '1',
|
||||||
|
'help' => '',
|
||||||
|
'readParms' => '',
|
||||||
|
'writeParms' => '',
|
||||||
|
'class' => 'left',
|
||||||
|
'thclass' => 'left',
|
||||||
|
),
|
||||||
|
'example_folder' =>
|
||||||
|
array (
|
||||||
|
'title' => 'Folder',
|
||||||
|
'type' => 'method',
|
||||||
|
'data' => 'safestr',
|
||||||
|
'width' => 'auto',
|
||||||
|
'help' => '',
|
||||||
|
'readParms' => '',
|
||||||
|
'writeParms' => '',
|
||||||
|
'class' => 'left',
|
||||||
|
'thclass' => 'left',
|
||||||
|
),
|
||||||
|
'example_version' =>
|
||||||
|
array (
|
||||||
|
'title' => 'Version',
|
||||||
|
'type' => 'text',
|
||||||
|
'data' => 'safestr',
|
||||||
|
'width' => 'auto',
|
||||||
|
'readonly' => '1',
|
||||||
|
'help' => '',
|
||||||
|
'readParms' => '',
|
||||||
|
'writeParms' => '',
|
||||||
|
'class' => 'left',
|
||||||
|
'thclass' => 'left',
|
||||||
|
),
|
||||||
|
'example_author' =>
|
||||||
|
array (
|
||||||
|
'title' => 'LAN_AUTHOR',
|
||||||
|
'type' => 'text',
|
||||||
|
'data' => 'safestr',
|
||||||
|
'width' => 'auto',
|
||||||
|
'help' => '',
|
||||||
|
'readParms' => '',
|
||||||
|
'writeParms' => '',
|
||||||
|
'class' => 'left',
|
||||||
|
'thclass' => 'left',
|
||||||
|
),
|
||||||
|
'example_authorURL' =>
|
||||||
|
array (
|
||||||
|
'title' => 'AuthorURL',
|
||||||
|
'type' => 'text',
|
||||||
|
'data' => 'safestr',
|
||||||
|
'width' => 'auto',
|
||||||
|
'help' => '',
|
||||||
|
'readParms' => '',
|
||||||
|
'writeParms' => '',
|
||||||
|
'class' => 'left',
|
||||||
|
'thclass' => 'left',
|
||||||
|
),
|
||||||
|
'example_date' =>
|
||||||
|
array (
|
||||||
|
'title' => 'LAN_DATESTAMP',
|
||||||
|
'type' => 'datestamp',
|
||||||
|
'data' => 'int',
|
||||||
|
'width' => 'auto',
|
||||||
|
'filter' => '1',
|
||||||
|
'fieldpref' => '1',
|
||||||
|
'help' => '',
|
||||||
|
'readParms' => '',
|
||||||
|
'writeParms' => '',
|
||||||
|
'class' => 'left',
|
||||||
|
'thclass' => 'left',
|
||||||
|
),
|
||||||
|
'example_compatibility' =>
|
||||||
|
array (
|
||||||
|
'title' => 'Compatibility',
|
||||||
|
'type' => 'text',
|
||||||
|
'data' => 'safestr',
|
||||||
|
'width' => 'auto',
|
||||||
|
'help' => '',
|
||||||
|
'readParms' => '',
|
||||||
|
'writeParms' => '',
|
||||||
|
'class' => 'left',
|
||||||
|
'thclass' => 'left',
|
||||||
|
),
|
||||||
|
'example_url' =>
|
||||||
|
array (
|
||||||
|
'title' => 'LAN_URL',
|
||||||
|
'type' => 'url',
|
||||||
|
'data' => 'safestr',
|
||||||
|
'width' => 'auto',
|
||||||
|
'inline' => '1',
|
||||||
|
'help' => '',
|
||||||
|
'readParms' => '',
|
||||||
|
'writeParms' => '',
|
||||||
|
'class' => 'left',
|
||||||
|
'thclass' => 'left',
|
||||||
|
),
|
||||||
|
'example_media' =>
|
||||||
|
array (
|
||||||
|
'title' => 'Media',
|
||||||
|
'type' => 'image',
|
||||||
|
'data' => 'str',
|
||||||
|
'width' => 'auto',
|
||||||
|
'help' => '',
|
||||||
|
'readParms' => '',
|
||||||
|
'writeParms' => '',
|
||||||
|
'class' => 'left',
|
||||||
|
'thclass' => 'left',
|
||||||
|
),
|
||||||
|
'example_class' =>
|
||||||
|
array (
|
||||||
|
'title' => 'LAN_USERCLASS',
|
||||||
|
'type' => 'userclass',
|
||||||
|
'data' => 'int',
|
||||||
|
'width' => 'auto',
|
||||||
|
'batch' => '1',
|
||||||
|
'filter' => '1',
|
||||||
|
'inline' => '1',
|
||||||
|
'fieldpref' => '1',
|
||||||
|
'help' => '',
|
||||||
|
'readParms' => '',
|
||||||
|
'writeParms' => '',
|
||||||
|
'class' => 'left',
|
||||||
|
'thclass' => 'left',
|
||||||
|
),
|
||||||
|
'options' =>
|
||||||
|
array (
|
||||||
|
'title' => 'LAN_OPTIONS',
|
||||||
|
'type' => '',
|
||||||
|
'data' => '',
|
||||||
|
'width' => '10%',
|
||||||
|
'thclass' => 'center last',
|
||||||
|
'class' => 'center last',
|
||||||
|
'forced' => 'value',
|
||||||
|
'fieldpref' => 'value',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'pid' => 'example_id',
|
||||||
|
),
|
||||||
|
'pluginPrefs' =>
|
||||||
|
array (
|
||||||
|
0 =>
|
||||||
|
array (
|
||||||
|
'index' => 'active',
|
||||||
|
'value' => '1',
|
||||||
|
'type' => 'boolean',
|
||||||
|
'help' => 'A help tip',
|
||||||
|
),
|
||||||
|
1 =>
|
||||||
|
array (
|
||||||
|
'index' => '',
|
||||||
|
'value' => '',
|
||||||
|
'type' => '',
|
||||||
|
'help' => '',
|
||||||
|
),
|
||||||
|
2 =>
|
||||||
|
array (
|
||||||
|
'index' => '',
|
||||||
|
'value' => '',
|
||||||
|
'type' => '',
|
||||||
|
'help' => '',
|
||||||
|
),
|
||||||
|
3 =>
|
||||||
|
array (
|
||||||
|
'index' => '',
|
||||||
|
'value' => '',
|
||||||
|
'type' => '',
|
||||||
|
'help' => '',
|
||||||
|
),
|
||||||
|
4 =>
|
||||||
|
array (
|
||||||
|
'index' => '',
|
||||||
|
'value' => '',
|
||||||
|
'type' => '',
|
||||||
|
'help' => '',
|
||||||
|
),
|
||||||
|
5 =>
|
||||||
|
array (
|
||||||
|
'index' => '',
|
||||||
|
'value' => '',
|
||||||
|
'type' => '',
|
||||||
|
'help' => '',
|
||||||
|
),
|
||||||
|
6 =>
|
||||||
|
array (
|
||||||
|
'index' => '',
|
||||||
|
'value' => '',
|
||||||
|
'type' => '',
|
||||||
|
'help' => '',
|
||||||
|
),
|
||||||
|
7 =>
|
||||||
|
array (
|
||||||
|
'index' => '',
|
||||||
|
'value' => '',
|
||||||
|
'type' => '',
|
||||||
|
'help' => '',
|
||||||
|
),
|
||||||
|
8 =>
|
||||||
|
array (
|
||||||
|
'index' => '',
|
||||||
|
'value' => '',
|
||||||
|
'type' => '',
|
||||||
|
'help' => '',
|
||||||
|
),
|
||||||
|
9 =>
|
||||||
|
array (
|
||||||
|
'index' => '',
|
||||||
|
'value' => '',
|
||||||
|
'type' => '',
|
||||||
|
'help' => '',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'newplugin' => 'example',
|
||||||
|
'step' => '4',
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
public function testSpecial()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGuess()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testForm()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCreateXml()
|
||||||
|
{
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public function testBuildAdminUI()
|
||||||
|
{
|
||||||
|
$result = $this->pb->buildAdminUI($this->posted, 'pluginfolder', 'PluginTitle');
|
||||||
|
$expected = "'example_id' => array ( 'title' => LAN_ID, 'type' => 'number', 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => [], 'writeParms' => [], 'class' => 'left', 'thclass' => 'left',)";
|
||||||
|
$this->assertStringContainsString($expected, $result);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
public function testRun()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPluginXml()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testXmlInput()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testStep4()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testStep3()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testStep1()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testEnterMysql()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testFieldType()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testFieldData()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPrefs()
|
||||||
|
{
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user