Skip to content

Commit

Permalink
Adapt for v6.0 beta 3
Browse files Browse the repository at this point in the history
  • Loading branch information
MantasVaitkunas committed Mar 7, 2017
1 parent 192b174 commit 1875f05
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
33 changes: 33 additions & 0 deletions UserUpdatableFields.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* @package extenduser
* @category module
* @author OXID eSales AG
* @link http://www.oxid-esales.com/en/
* @licenses GNU GENERAL PUBLIC LICENSE. More info can be found in LICENSE file.
* @copyright (C) OXID e-Sales, 2003-2017
*/

namespace OxidEsales\ExtendUser;

/**
* @see \OxidEsales\Eshop\Application\Model\User\UserUpdatableFields
*/
class UserUpdatableFields extends UserUpdatableFields_parent
{
protected $fieldsToAdd = [
UserModel::FIELD_ADDITIONAL_INFORMATION
];

/**
* Adds additional field which could be updated.
*
* @return array
*/
public function getUpdatableFields()
{
$updatableFields = parent::getUpdatableFields();

return array_merge($updatableFields, $this->fieldsToAdd);
}
}
1 change: 1 addition & 0 deletions metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
'url' => 'http://www.oxid-esales.com',
'email' => 'mantas.vaitkunas@oxid-esales.com',
'extend' => array(
\OxidEsales\Eshop\Application\Model\User\UserUpdatableFields::class => \OxidEsales\ExtendUser\UserUpdatableFields::class
),
'events' => array(
'onActivate' => \OxidEsales\ExtendUser\ModuleEvents::class.'::onActivate',
Expand Down
29 changes: 29 additions & 0 deletions tests/Integration/UserUpdatableFieldsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
* @package extenduser
* @category module
* @author OXID eSales AG
* @link http://www.oxid-esales.com/en/
* @licenses GNU GENERAL PUBLIC LICENSE. More info can be found in LICENSE file.
* @copyright (C) OXID e-Sales, 2003-2017
*/

namespace OxidEsales\ExtendUser\tests\Integration;

use OxidEsales\Eshop\Application\Model\User\UserUpdatableFields;
use OxidEsales\ExtendUser\UserModel;
use OxidEsales\TestingLibrary\UnitTestCase;

class UserUpdatableFieldsTest extends UnitTestCase
{
public function testIsFieldAddedToWhiteList()
{
/** @var UserUpdatableFields $userUpdatableFields */
$userUpdatableFields = oxNew(UserUpdatableFields::class);

$this->assertTrue(in_array(UserModel::FIELD_ADDITIONAL_INFORMATION, $userUpdatableFields->getUpdatableFields()),
'In updatable fields array missing field: '.UserModel::FIELD_ADDITIONAL_INFORMATION.'. Returned array is: '
.implode(" ",$userUpdatableFields->getUpdatableFields())
);
}
}

0 comments on commit 1875f05

Please sign in to comment.