Skip to content

Commit

Permalink
feature/Unit-test was added
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdodonov committed Jan 26, 2022
1 parent 5b25920 commit ed3d599
Show file tree
Hide file tree
Showing 19 changed files with 93 additions and 53 deletions.
2 changes: 1 addition & 1 deletion Mezon/Gui/Control.php
Expand Up @@ -8,7 +8,7 @@
* @subpackage Control
* @author Dodonov A.A.
* @version v.1.0 (2019/09/14)
* @copyright Copyright (c) 2019, aeon.org
* @copyright Copyright (c) 2019, http://aeon.su
*/

/**
Expand Down
5 changes: 3 additions & 2 deletions Mezon/Gui/Field/CustomField.php
Expand Up @@ -2,6 +2,7 @@
namespace Mezon\Gui\Field;

use Mezon\TemplateEngine\TemplateEngine;
use Mezon\Gui\Field;

/**
* Class CustomField
Expand All @@ -10,13 +11,13 @@
* @subpackage CustomField
* @author Dodonov A.A.
* @version v.1.0 (2019/09/13)
* @copyright Copyright (c) 2019, aeon.org
* @copyright Copyright (c) 2019, http://aeon.su
*/

/**
* Custom field control
*/
class CustomField extends \Mezon\Gui\Field
class CustomField extends Field
{

/**
Expand Down
6 changes: 4 additions & 2 deletions Mezon/Gui/Field/InputDate.php
@@ -1,20 +1,22 @@
<?php
namespace Mezon\Gui\Field;

use Mezon\Gui\Field;

/**
* Class InputDate
*
* @package Field
* @subpackage InputDate
* @author Dodonov A.A.
* @version v.1.0 (2019/09/13)
* @copyright Copyright (c) 2019, aeon.org
* @copyright Copyright (c) 2019, http://aeon.su
*/

/**
* Input field control
*/
class InputDate extends \Mezon\Gui\Field
class InputDate extends Field
{

/**
Expand Down
6 changes: 4 additions & 2 deletions Mezon/Gui/Field/InputFile.php
@@ -1,20 +1,22 @@
<?php
namespace Mezon\Gui\Field;

use Mezon\Gui\Field;

/**
* Class InputFile
*
* @package Field
* @subpackage InputFile
* @author Dodonov A.A.
* @version v.1.0 (2019/09/04)
* @copyright Copyright (c) 2019, aeon.org
* @copyright Copyright (c) 2019, http://aeon.su
*/

/**
* Input field control
*/
class InputFile extends \Mezon\Gui\Field
class InputFile extends Field
{

/**
Expand Down
6 changes: 4 additions & 2 deletions Mezon/Gui/Field/InputText.php
@@ -1,20 +1,22 @@
<?php
namespace Mezon\Gui\Field;

use Mezon\Gui\Field;

/**
* Class InputText
*
* @package Field
* @subpackage InputText
* @author Dodonov A.A.
* @version v.1.0 (2019/09/04)
* @copyright Copyright (c) 2019, aeon.org
* @copyright Copyright (c) 2019, http://aeon.su
*/

/**
* Input field control
*/
class InputText extends \Mezon\Gui\Field
class InputText extends Field
{

/**
Expand Down
4 changes: 2 additions & 2 deletions Mezon/Gui/Field/LabelField.php
Expand Up @@ -8,13 +8,13 @@
* @subpackage LabelField
* @author Dodonov A.A.
* @version v.1.0 (2019/09/04)
* @copyright Copyright (c) 2019, aeon.org
* @copyright Copyright (c) 2019, http://aeon.su
*/

/**
* Form header control
*/
class LabelField extends \Mezon\Gui\Field\TextField
class LabelField extends TextField
{

/**
Expand Down
6 changes: 4 additions & 2 deletions Mezon/Gui/Field/Select.php
@@ -1,20 +1,22 @@
<?php
namespace Mezon\Gui\Field;

use Mezon\Gui\Field;

/**
* Class Select
*
* @package Field
* @subpackage Select
* @author Dodonov A.A.
* @version v.1.0 (2019/09/04)
* @copyright Copyright (c) 2019, aeon.org
* @copyright Copyright (c) 2019, http://aeon.su
*/

/**
* Text area control
*/
class Select extends \Mezon\Gui\Field
class Select extends Field
{

/**
Expand Down
6 changes: 4 additions & 2 deletions Mezon/Gui/Field/TextField.php
@@ -1,20 +1,22 @@
<?php
namespace Mezon\Gui\Field;

use Mezon\Gui\Control;

/**
* Class TextField
*
* @package Field
* @subpackage TextField
* @author Dodonov A.A.
* @version v.1.0 (2019/09/04)
* @copyright Copyright (c) 2019, aeon.org
* @copyright Copyright (c) 2019, http://aeon.su
*/

/**
* Text field control
*/
class TextField implements \Mezon\Gui\Control
class TextField implements Control
{

/**
Expand Down
6 changes: 4 additions & 2 deletions Mezon/Gui/Field/Textarea.php
@@ -1,20 +1,22 @@
<?php
namespace Mezon\Gui\Field;

use Mezon\Gui\Field;

/**
* Class Textarea
*
* @package Field
* @subpackage Textarea
* @author Dodonov A.A.
* @version v.1.0 (2019/09/04)
* @copyright Copyright (c) 2019, aeon.org
* @copyright Copyright (c) 2019, http://aeon.su
*/

/**
* Text area control
*/
class Textarea extends \Mezon\Gui\Field
class Textarea extends Field
{

/**
Expand Down
16 changes: 11 additions & 5 deletions Mezon/Gui/FieldsAlgorithms.php
Expand Up @@ -11,6 +11,7 @@
use Mezon\Gui\Field\Textarea;
use Mezon\Gui\FormBuilder\RowsField;
use Mezon\Security\Security;
use Mezon\FieldsSet;

/**
* Class FieldsAlgorithms
Expand All @@ -19,13 +20,13 @@
* @subpackage FieldsAlgorithms
* @author Dodonov A.A.
* @version v.1.0 (2019/08/08)
* @copyright Copyright (c) 2019, aeon.org
* @copyright Copyright (c) 2019, http://aeon.su
*/

/**
* Class constructs forms
*/
class FieldsAlgorithms extends \Mezon\FieldsSet
class FieldsAlgorithms extends FieldsSet
{

/**
Expand Down Expand Up @@ -276,7 +277,7 @@ public function fetchCustomField(array &$record, string $name): array
* @param string $name
* name od the field
*/
public function fetchField(array &$record, string $name)
public function fetchField(array &$record, string $name):void
{
if (isset($_POST[$this->entityName . '-' . $name])) {
$record[$name] = $this->getSecureValue($name, $_POST[$this->entityName . '-' . $name]);
Expand Down Expand Up @@ -304,10 +305,15 @@ protected function constructControl(array $field)

$field['session-id'] = $this->sessionId;

return new $className($field);
/** @var Control|Field $control */
$control = new $className($field);

return $control;
} else {
return new InputText($field);
}
} else {
throw (new \Exception('Can not define control\'s type', - 1));
}
}

Expand All @@ -322,7 +328,7 @@ protected function initObject(array $field)
{
if (isset($field['control']) && $field['control'] == 'textarea') {
$control = new Textarea($field);
} elseif ($field['type'] == 'rows') {
} elseif (isset($field['type']) && $field['type'] == 'rows') {
$control = new RowsField($field['type']['rows'], $this->entityName);
} else {
$control = $this->constructControl($field);
Expand Down
6 changes: 4 additions & 2 deletions Mezon/Gui/FormBuilder/FormHeader.php
@@ -1,20 +1,22 @@
<?php
namespace Mezon\Gui\FormBuilder;

use Mezon\Gui\Field\TextField;

/**
* Class FormHeader
*
* @package Field
* @subpackage FormHeader
* @author Dodonov A.A.
* @version v.1.0 (2019/09/04)
* @copyright Copyright (c) 2019, aeon.org
* @copyright Copyright (c) 2019, http://aeon.su
*/

/**
* Form header control
*/
class FormHeader extends \Mezon\Gui\Field\TextField
class FormHeader extends TextField
{

/**
Expand Down
2 changes: 1 addition & 1 deletion Mezon/Gui/FormBuilder/RowsField.php
Expand Up @@ -11,7 +11,7 @@
* @subpackage RowsField
* @author Dodonov A.A.
* @version v.1.0 (2019/09/22)
* @copyright Copyright (c) 2019, aeon.org
* @copyright Copyright (c) 2019, http://aeon.su
*/

/**
Expand Down

0 comments on commit ed3d599

Please sign in to comment.