diff --git a/.github/.htaccess b/.github/.htaccess new file mode 100644 index 0000000000000..93169e4eb44ff --- /dev/null +++ b/.github/.htaccess @@ -0,0 +1,2 @@ +Order deny,allow +Deny from all diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000000..4e82725a7fb08 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at engcom@magento.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to .github/CONTRIBUTING.md diff --git a/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md similarity index 100% rename from ISSUE_TEMPLATE.md rename to .github/ISSUE_TEMPLATE.md diff --git a/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from PULL_REQUEST_TEMPLATE.md rename to .github/PULL_REQUEST_TEMPLATE.md diff --git a/.gitignore b/.gitignore index bae558e0e5b9a..94c3bf76a2bd1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /.metadata /.project /.settings +/.vscode atlassian* /nbproject /robots.txt diff --git a/.htaccess b/.htaccess index 90b9c16a5a8c0..3e6eb31938e46 100644 --- a/.htaccess +++ b/.htaccess @@ -234,10 +234,6 @@ order allow,deny deny from all - - order allow,deny - deny from all - order allow,deny deny from all diff --git a/.htaccess.sample b/.htaccess.sample index 3b61bb672ec8a..e70eb9d022412 100644 --- a/.htaccess.sample +++ b/.htaccess.sample @@ -210,10 +210,6 @@ order allow,deny deny from all - - order allow,deny - deny from all - order allow,deny deny from all diff --git a/.travis.yml b/.travis.yml index 649762d8e9f3c..7c300af70dc4e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ sudo: required dist: trusty +group: edge addons: apt: packages: @@ -28,8 +29,7 @@ env: - TEST_SUITE=integration INTEGRATION_INDEX=1 - TEST_SUITE=integration INTEGRATION_INDEX=2 - TEST_SUITE=integration INTEGRATION_INDEX=3 - - TEST_SUITE=functional ACCEPTANCE_INDEX=1 - - TEST_SUITE=functional ACCEPTANCE_INDEX=2 + - TEST_SUITE=functional matrix: exclude: - php: 7.0 @@ -39,9 +39,7 @@ matrix: - php: 7.0 env: TEST_SUITE=js GRUNT_COMMAND=static - php: 7.0 - env: TEST_SUITE=functional ACCEPTANCE_INDEX=1 - - php: 7.0 - env: TEST_SUITE=functional ACCEPTANCE_INDEX=2 + env: TEST_SUITE=functional cache: apt: true directories: @@ -50,7 +48,7 @@ cache: - $HOME/node_modules - $HOME/yarn.lock before_install: ./dev/travis/before_install.sh -install: composer install --no-interaction --prefer-dist +install: composer install --no-interaction before_script: ./dev/travis/before_script.sh script: # Set arguments for variants of phpunit based tests; '|| true' prevents failing script when leading test fails @@ -58,5 +56,6 @@ script: - test $TEST_SUITE = "functional" && TEST_FILTER='dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests.php' || true # The scripts for grunt/phpunit type tests - - if [ $TEST_SUITE != "js" ]; then phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi + - if [ $TEST_SUITE == "functional" ]; then dev/tests/functional/vendor/phpunit/phpunit/phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi + - if [ $TEST_SUITE != "functional" ] && [ $TEST_SUITE != "js" ]; then phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi - if [ $TEST_SUITE == "js" ]; then grunt $GRUNT_COMMAND; fi diff --git a/app/bootstrap.php b/app/bootstrap.php index 94142dcf0c225..414139560f38e 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -63,5 +63,5 @@ date_default_timezone_set('UTC'); /* Adjustment of precision value for several versions of PHP */ -ini_set('precision', 17); -ini_set('serialize_precision', 17); +ini_set('precision', 15); +ini_set('serialize_precision', 15); diff --git a/app/code/Magento/AdminNotification/Block/Inbox.php b/app/code/Magento/AdminNotification/Block/Inbox.php index 7137181e3cb3d..4c989f74991ff 100644 --- a/app/code/Magento/AdminNotification/Block/Inbox.php +++ b/app/code/Magento/AdminNotification/Block/Inbox.php @@ -9,6 +9,7 @@ /** * @api + * @since 100.0.2 */ class Inbox extends \Magento\Backend\Block\Widget\Grid\Container { diff --git a/app/code/Magento/AdminNotification/Block/System/Messages/UnreadMessagePopup.php b/app/code/Magento/AdminNotification/Block/System/Messages/UnreadMessagePopup.php index bd9153968973f..7ea0062581467 100644 --- a/app/code/Magento/AdminNotification/Block/System/Messages/UnreadMessagePopup.php +++ b/app/code/Magento/AdminNotification/Block/System/Messages/UnreadMessagePopup.php @@ -9,6 +9,7 @@ /** * @api + * @since 100.0.2 */ class UnreadMessagePopup extends \Magento\Backend\Block\Template { diff --git a/app/code/Magento/AdminNotification/Block/ToolbarEntry.php b/app/code/Magento/AdminNotification/Block/ToolbarEntry.php index 9b05dd200e31c..c097edfd8af65 100644 --- a/app/code/Magento/AdminNotification/Block/ToolbarEntry.php +++ b/app/code/Magento/AdminNotification/Block/ToolbarEntry.php @@ -11,6 +11,7 @@ * * @api * @author Magento Core Team + * @since 100.0.2 */ class ToolbarEntry extends \Magento\Backend\Block\Template { diff --git a/app/code/Magento/AdminNotification/Block/Window.php b/app/code/Magento/AdminNotification/Block/Window.php index 277e25dac1727..b80e12a8674db 100644 --- a/app/code/Magento/AdminNotification/Block/Window.php +++ b/app/code/Magento/AdminNotification/Block/Window.php @@ -9,6 +9,7 @@ /** * @api + * @since 100.0.2 */ class Window extends \Magento\Backend\Block\Template { diff --git a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification.php b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification.php index a3118d5da12cd..cb50a9d0705bb 100644 --- a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification.php +++ b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification.php @@ -7,6 +7,10 @@ */ namespace Magento\AdminNotification\Controller\Adminhtml; +/** + * @api + * @since 100.0.2 + */ abstract class Notification extends \Magento\Backend\App\AbstractAction { /** diff --git a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/AjaxMarkAsRead.php b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/AjaxMarkAsRead.php index 31a129d57ab90..da797fe12e75a 100644 --- a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/AjaxMarkAsRead.php +++ b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/AjaxMarkAsRead.php @@ -6,12 +6,35 @@ */ namespace Magento\AdminNotification\Controller\Adminhtml\Notification; +use Magento\Backend\App\Action; +use Magento\Framework\Controller\ResultFactory; + class AjaxMarkAsRead extends \Magento\AdminNotification\Controller\Adminhtml\Notification { + /** + * @var \Magento\AdminNotification\Model\NotificationService + */ + private $notificationService; + + /** + * @param Action\Context $context + * @param \Magento\AdminNotification\Model\NotificationService|null $notificationService + * @throws \RuntimeException + */ + public function __construct( + Action\Context $context, + \Magento\AdminNotification\Model\NotificationService $notificationService = null + ) { + parent::__construct($context); + $this->notificationService = $notificationService?: \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\AdminNotification\Model\NotificationService::class); + } + /** * Mark notification as read (AJAX action) * - * @return void + * @return \Magento\Framework\Controller\Result\Json|void + * @throws \InvalidArgumentException */ public function execute() { @@ -21,17 +44,15 @@ public function execute() $notificationId = (int)$this->getRequest()->getPost('id'); $responseData = []; try { - $this->_objectManager->create( - \Magento\AdminNotification\Model\NotificationService::class - )->markAsRead( - $notificationId - ); + $this->notificationService->markAsRead($notificationId); $responseData['success'] = true; } catch (\Exception $e) { $responseData['success'] = false; } - $this->getResponse()->representJson( - $this->_objectManager->create(\Magento\Framework\Json\Helper\Data::class)->jsonEncode($responseData) - ); + + /** @var \Magento\Framework\Controller\Result\Json $resultJson */ + $resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON); + $resultJson->setData($responseData); + return $resultJson; } } diff --git a/app/code/Magento/AdminNotification/Model/Config/Source/Frequency.php b/app/code/Magento/AdminNotification/Model/Config/Source/Frequency.php index 7b97a4f266bec..6defd92ea48cb 100644 --- a/app/code/Magento/AdminNotification/Model/Config/Source/Frequency.php +++ b/app/code/Magento/AdminNotification/Model/Config/Source/Frequency.php @@ -9,6 +9,8 @@ * AdminNotification update frequency source * * @codeCoverageIgnore + * @api + * @since 100.0.2 */ class Frequency implements \Magento\Framework\Option\ArrayInterface { diff --git a/app/code/Magento/AdminNotification/Model/Feed.php b/app/code/Magento/AdminNotification/Model/Feed.php index 3e0f12565aa04..ea08cc13800de 100644 --- a/app/code/Magento/AdminNotification/Model/Feed.php +++ b/app/code/Magento/AdminNotification/Model/Feed.php @@ -12,6 +12,8 @@ * * @author Magento Core Team * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @api + * @since 100.0.2 */ class Feed extends \Magento\Framework\Model\AbstractModel { diff --git a/app/code/Magento/AdminNotification/Model/Inbox.php b/app/code/Magento/AdminNotification/Model/Inbox.php index 28dd226a4488e..174ca7545b092 100644 --- a/app/code/Magento/AdminNotification/Model/Inbox.php +++ b/app/code/Magento/AdminNotification/Model/Inbox.php @@ -12,8 +12,6 @@ /** * AdminNotification Inbox model * - * @method \Magento\AdminNotification\Model\ResourceModel\Inbox _getResource() - * @method \Magento\AdminNotification\Model\ResourceModel\Inbox getResource() * @method int getSeverity() * @method \Magento\AdminNotification\Model\Inbox setSeverity(int $value) * @method string getDateAdded() @@ -29,7 +27,8 @@ * @method int getIsRemove() * @method \Magento\AdminNotification\Model\Inbox setIsRemove(int $value) * - * @author Magento Core Team + * @api + * @since 100.0.2 */ class Inbox extends \Magento\Framework\Model\AbstractModel implements NotifierInterface, InboxInterface { diff --git a/app/code/Magento/AdminNotification/Model/InboxInterface.php b/app/code/Magento/AdminNotification/Model/InboxInterface.php index b81d8007bb0ee..4e87822763fc3 100644 --- a/app/code/Magento/AdminNotification/Model/InboxInterface.php +++ b/app/code/Magento/AdminNotification/Model/InboxInterface.php @@ -9,6 +9,8 @@ * AdminNotification Inbox interface * * @author Magento Core Team + * @api + * @since 100.0.2 */ interface InboxInterface { diff --git a/app/code/Magento/AdminNotification/Model/NotificationService.php b/app/code/Magento/AdminNotification/Model/NotificationService.php index 7da8a0117b39b..d44e98aaf2203 100644 --- a/app/code/Magento/AdminNotification/Model/NotificationService.php +++ b/app/code/Magento/AdminNotification/Model/NotificationService.php @@ -9,6 +9,8 @@ * Notification service model * * @author Magento Core Team + * @api + * @since 100.0.2 */ class NotificationService { diff --git a/app/code/Magento/AdminNotification/Model/ResourceModel/Grid/Collection.php b/app/code/Magento/AdminNotification/Model/ResourceModel/Grid/Collection.php index 8e2b0c8787f0d..e12419155d52b 100644 --- a/app/code/Magento/AdminNotification/Model/ResourceModel/Grid/Collection.php +++ b/app/code/Magento/AdminNotification/Model/ResourceModel/Grid/Collection.php @@ -11,6 +11,10 @@ */ namespace Magento\AdminNotification\Model\ResourceModel\Grid; +/** + * @api + * @since 100.0.2 + */ class Collection extends \Magento\AdminNotification\Model\ResourceModel\Inbox\Collection { /** diff --git a/app/code/Magento/AdminNotification/Model/ResourceModel/Inbox.php b/app/code/Magento/AdminNotification/Model/ResourceModel/Inbox.php index d9274f651170d..a92eebfaec510 100644 --- a/app/code/Magento/AdminNotification/Model/ResourceModel/Inbox.php +++ b/app/code/Magento/AdminNotification/Model/ResourceModel/Inbox.php @@ -6,9 +6,8 @@ namespace Magento\AdminNotification\Model\ResourceModel; /** - * AdminNotification Inbox model - * - * @author Magento Core Team + * @api + * @since 100.0.2 */ class Inbox extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb { diff --git a/app/code/Magento/AdminNotification/Model/ResourceModel/Inbox/Collection.php b/app/code/Magento/AdminNotification/Model/ResourceModel/Inbox/Collection.php index c450f0da54499..44ec765b9d0a2 100644 --- a/app/code/Magento/AdminNotification/Model/ResourceModel/Inbox/Collection.php +++ b/app/code/Magento/AdminNotification/Model/ResourceModel/Inbox/Collection.php @@ -10,6 +10,8 @@ * * @api * @author Magento Core Team + * @api + * @since 100.0.2 */ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection { diff --git a/app/code/Magento/AdminNotification/Model/ResourceModel/Inbox/Collection/Critical.php b/app/code/Magento/AdminNotification/Model/ResourceModel/Inbox/Collection/Critical.php index 39246777494ee..47091ba5458cc 100644 --- a/app/code/Magento/AdminNotification/Model/ResourceModel/Inbox/Collection/Critical.php +++ b/app/code/Magento/AdminNotification/Model/ResourceModel/Inbox/Collection/Critical.php @@ -7,6 +7,10 @@ */ namespace Magento\AdminNotification\Model\ResourceModel\Inbox\Collection; +/** + * @api + * @since 100.0.2 + */ class Critical extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection { /** diff --git a/app/code/Magento/AdminNotification/Model/ResourceModel/Inbox/Collection/Unread.php b/app/code/Magento/AdminNotification/Model/ResourceModel/Inbox/Collection/Unread.php index 0f9054f1aeb69..b9e77f8a35295 100644 --- a/app/code/Magento/AdminNotification/Model/ResourceModel/Inbox/Collection/Unread.php +++ b/app/code/Magento/AdminNotification/Model/ResourceModel/Inbox/Collection/Unread.php @@ -11,6 +11,10 @@ */ namespace Magento\AdminNotification\Model\ResourceModel\Inbox\Collection; +/** + * @api + * @since 100.0.2 + */ class Unread extends \Magento\AdminNotification\Model\ResourceModel\Inbox\Collection { /** diff --git a/app/code/Magento/AdminNotification/Model/ResourceModel/System/Message.php b/app/code/Magento/AdminNotification/Model/ResourceModel/System/Message.php index a1d2f981e1185..c7e9d348f3aca 100644 --- a/app/code/Magento/AdminNotification/Model/ResourceModel/System/Message.php +++ b/app/code/Magento/AdminNotification/Model/ResourceModel/System/Message.php @@ -5,6 +5,10 @@ */ namespace Magento\AdminNotification\Model\ResourceModel\System; +/** + * @api + * @since 100.0.2 + */ class Message extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb { /** diff --git a/app/code/Magento/AdminNotification/Model/ResourceModel/System/Message/Collection.php b/app/code/Magento/AdminNotification/Model/ResourceModel/System/Message/Collection.php index d3b94e491f2e8..31946200d296b 100644 --- a/app/code/Magento/AdminNotification/Model/ResourceModel/System/Message/Collection.php +++ b/app/code/Magento/AdminNotification/Model/ResourceModel/System/Message/Collection.php @@ -5,6 +5,10 @@ */ namespace Magento\AdminNotification\Model\ResourceModel\System\Message; +/** + * @api + * @since 100.0.2 + */ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection { /** diff --git a/app/code/Magento/AdminNotification/Model/ResourceModel/System/Message/Collection/Synchronized.php b/app/code/Magento/AdminNotification/Model/ResourceModel/System/Message/Collection/Synchronized.php index 6db18a70c613a..097e84ceff83c 100644 --- a/app/code/Magento/AdminNotification/Model/ResourceModel/System/Message/Collection/Synchronized.php +++ b/app/code/Magento/AdminNotification/Model/ResourceModel/System/Message/Collection/Synchronized.php @@ -5,6 +5,10 @@ */ namespace Magento\AdminNotification\Model\ResourceModel\System\Message\Collection; +/** + * @api + * @since 100.0.2 + */ class Synchronized extends \Magento\AdminNotification\Model\ResourceModel\System\Message\Collection { /** diff --git a/app/code/Magento/AdminNotification/Model/System/Message.php b/app/code/Magento/AdminNotification/Model/System/Message.php index bb1611b98cb23..ed5e2c8854440 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message.php +++ b/app/code/Magento/AdminNotification/Model/System/Message.php @@ -7,6 +7,8 @@ /** * @codeCoverageIgnore + * @api + * @since 100.0.2 */ class Message extends \Magento\Framework\Model\AbstractModel implements \Magento\Framework\Notification\MessageInterface { diff --git a/app/code/Magento/AdminNotification/Model/System/Message/Baseurl.php b/app/code/Magento/AdminNotification/Model/System/Message/Baseurl.php index 2f686b542fd2c..f7374a961bc84 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message/Baseurl.php +++ b/app/code/Magento/AdminNotification/Model/System/Message/Baseurl.php @@ -9,7 +9,7 @@ use Magento\Store\Model\Store; /** - * @deprecated + * @deprecated 100.1.0 */ class Baseurl implements \Magento\Framework\Notification\MessageInterface { diff --git a/app/code/Magento/AdminNotification/Model/System/Message/CacheOutdated.php b/app/code/Magento/AdminNotification/Model/System/Message/CacheOutdated.php index 37488006e3491..c4884ee840ba3 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message/CacheOutdated.php +++ b/app/code/Magento/AdminNotification/Model/System/Message/CacheOutdated.php @@ -5,6 +5,10 @@ */ namespace Magento\AdminNotification\Model\System\Message; +/** + * @api + * @since 100.0.2 + */ class CacheOutdated implements \Magento\Framework\Notification\MessageInterface { /** diff --git a/app/code/Magento/AdminNotification/Model/System/Message/Media/AbstractSynchronization.php b/app/code/Magento/AdminNotification/Model/System/Message/Media/AbstractSynchronization.php index 2494c3a538272..daf29db540d4d 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message/Media/AbstractSynchronization.php +++ b/app/code/Magento/AdminNotification/Model/System/Message/Media/AbstractSynchronization.php @@ -5,6 +5,10 @@ */ namespace Magento\AdminNotification\Model\System\Message\Media; +/** + * @api + * @since 100.0.2 + */ abstract class AbstractSynchronization implements \Magento\Framework\Notification\MessageInterface { /** diff --git a/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Error.php b/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Error.php index 18e06e3b3a497..38477c015cad3 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Error.php +++ b/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Error.php @@ -6,6 +6,10 @@ namespace Magento\AdminNotification\Model\System\Message\Media\Synchronization; +/** + * @api + * @since 100.0.2 + */ class Error extends \Magento\AdminNotification\Model\System\Message\Media\AbstractSynchronization { /** diff --git a/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Success.php b/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Success.php index 2569906f662b1..81bea14099e9e 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Success.php +++ b/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Success.php @@ -5,6 +5,10 @@ */ namespace Magento\AdminNotification\Model\System\Message\Media\Synchronization; +/** + * @api + * @since 100.0.2 + */ class Success extends \Magento\AdminNotification\Model\System\Message\Media\AbstractSynchronization { /** diff --git a/app/code/Magento/AdminNotification/Model/System/Message/Security.php b/app/code/Magento/AdminNotification/Model/System/Message/Security.php index cb706f8741830..7cbdd68727b94 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message/Security.php +++ b/app/code/Magento/AdminNotification/Model/System/Message/Security.php @@ -8,6 +8,10 @@ use Magento\Store\Model\Store; +/** + * @api + * @since 100.0.2 + */ class Security implements \Magento\Framework\Notification\MessageInterface { /** diff --git a/app/code/Magento/AdminNotification/Test/Unit/Block/ToolbarEntryTest.php b/app/code/Magento/AdminNotification/Test/Unit/Block/ToolbarEntryTest.php index 150e406e4c4a4..2afa9eced1d95 100644 --- a/app/code/Magento/AdminNotification/Test/Unit/Block/ToolbarEntryTest.php +++ b/app/code/Magento/AdminNotification/Test/Unit/Block/ToolbarEntryTest.php @@ -9,7 +9,7 @@ */ namespace Magento\AdminNotification\Test\Unit\Block; -class ToolbarEntryTest extends \PHPUnit_Framework_TestCase +class ToolbarEntryTest extends \PHPUnit\Framework\TestCase { /** * Retrieve toolbar entry block instance @@ -21,12 +21,9 @@ protected function _getBlockInstance($unreadNotifications) { $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); // mock collection of unread notifications - $notificationList = $this->getMock( + $notificationList = $this->createPartialMock( \Magento\AdminNotification\Model\ResourceModel\Inbox\Collection\Unread::class, - ['getSize', 'setCurPage', 'setPageSize'], - [], - '', - false + ['getSize', 'setCurPage', 'setPageSize'] ); $notificationList->expects($this->any())->method('getSize')->will($this->returnValue($unreadNotifications)); diff --git a/app/code/Magento/AdminNotification/Test/Unit/Model/FeedTest.php b/app/code/Magento/AdminNotification/Test/Unit/Model/FeedTest.php index 8423f091b5ccc..6dea86d1f5892 100644 --- a/app/code/Magento/AdminNotification/Test/Unit/Model/FeedTest.php +++ b/app/code/Magento/AdminNotification/Test/Unit/Model/FeedTest.php @@ -6,13 +6,13 @@ namespace Magento\AdminNotification\Test\Unit\Model; -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; use Magento\Framework\Config\ConfigOptionsListConstants; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class FeedTest extends \PHPUnit_Framework_TestCase +class FeedTest extends \PHPUnit\Framework\TestCase { /** @var \Magento\AdminNotification\Model\Feed */ protected $feed; @@ -52,34 +52,19 @@ class FeedTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->inboxFactory = $this->getMock( + $this->inboxFactory = $this->createPartialMock( \Magento\AdminNotification\Model\InboxFactory::class, - ['create'], - [], - '', - false - ); - $this->curlFactory = $this->getMock( - \Magento\Framework\HTTP\Adapter\CurlFactory::class, - ['create'], - [], - '', - false + ['create'] ); + $this->curlFactory = $this->createPartialMock(\Magento\Framework\HTTP\Adapter\CurlFactory::class, ['create']); $this->curl = $this->getMockBuilder(\Magento\Framework\HTTP\Adapter\Curl::class) ->disableOriginalConstructor()->getMock(); - $this->appState = $this->getMock(\Magento\Framework\App\State::class, ['getInstallDate'], [], '', false); - $this->inboxModel = $this->getMock( - \Magento\AdminNotification\Model\Inbox::class, - [ + $this->appState = $this->createPartialMock(\Magento\Framework\App\State::class, ['getInstallDate']); + $this->inboxModel = $this->createPartialMock(\Magento\AdminNotification\Model\Inbox::class, [ '__wakeup', 'parse' - ], - [], - '', - false - ); - $this->backendConfig = $this->getMock( + ]); + $this->backendConfig = $this->createPartialMock( \Magento\Backend\App\ConfigInterface::class, [ 'getValue', @@ -87,7 +72,7 @@ protected function setUp() 'isSetFlag' ] ); - $this->cacheManager = $this->getMock( + $this->cacheManager = $this->createPartialMock( \Magento\Framework\App\CacheInterface::class, [ 'load', @@ -106,7 +91,7 @@ protected function setUp() $this->productMetadata = $this->getMockBuilder(\Magento\Framework\App\ProductMetadata::class) ->disableOriginalConstructor()->getMock(); - $this->urlBuilder = $this->getMock(\Magento\Framework\UrlInterface::class); + $this->urlBuilder = $this->createMock(\Magento\Framework\UrlInterface::class); $this->feed = $this->objectManagerHelper->getObject( \Magento\AdminNotification\Model\Feed::class, diff --git a/app/code/Magento/AdminNotification/Test/Unit/Model/NotificationServiceTest.php b/app/code/Magento/AdminNotification/Test/Unit/Model/NotificationServiceTest.php index d72351c8ad4ed..f8485847ccae2 100644 --- a/app/code/Magento/AdminNotification/Test/Unit/Model/NotificationServiceTest.php +++ b/app/code/Magento/AdminNotification/Test/Unit/Model/NotificationServiceTest.php @@ -9,7 +9,7 @@ */ namespace Magento\AdminNotification\Test\Unit\Model; -class NotificationServiceTest extends \PHPUnit_Framework_TestCase +class NotificationServiceTest extends \PHPUnit\Framework\TestCase { /** * Retrieve instance of notification service model @@ -23,19 +23,13 @@ protected function _getServiceInstanceForMarkAsReadTest($notificationId) * @var * $notificationFactory \PHPUnit_Framework_MockObject_MockObject|\Magento\AdminNotification\Model\InboxFactory */ - $notificationFactory = $this->getMock( + $notificationFactory = $this->createPartialMock( \Magento\AdminNotification\Model\InboxFactory::class, - ['create'], - [], - '', - false + ['create'] ); - $notification = $this->getMock( + $notification = $this->createPartialMock( \Magento\AdminNotification\Model\Inbox::class, - ['load', 'getId', 'save', 'setIsRead', '__sleep', '__wakeup'], - [], - '', - false + ['load', 'getId', 'save', 'setIsRead', '__sleep', '__wakeup'] ); $notification->expects($this->once())->method('load')->with($notificationId)->will($this->returnSelf()); $notification->expects($this->once())->method('getId')->will($this->returnValue($notificationId)); diff --git a/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/CacheOutdatedTest.php b/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/CacheOutdatedTest.php index ae177b4e8d597..2fbfc43aa8775 100644 --- a/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/CacheOutdatedTest.php +++ b/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/CacheOutdatedTest.php @@ -5,7 +5,7 @@ */ namespace Magento\AdminNotification\Test\Unit\Model\System\Message; -class CacheOutdatedTest extends \PHPUnit_Framework_TestCase +class CacheOutdatedTest extends \PHPUnit\Framework\TestCase { /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -29,9 +29,9 @@ class CacheOutdatedTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_authorizationMock = $this->getMock(\Magento\Framework\AuthorizationInterface::class); - $this->_urlInterfaceMock = $this->getMock(\Magento\Framework\UrlInterface::class); - $this->_cacheTypeListMock = $this->getMock(\Magento\Framework\App\Cache\TypeListInterface::class); + $this->_authorizationMock = $this->createMock(\Magento\Framework\AuthorizationInterface::class); + $this->_urlInterfaceMock = $this->createMock(\Magento\Framework\UrlInterface::class); + $this->_cacheTypeListMock = $this->createMock(\Magento\Framework\App\Cache\TypeListInterface::class); $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $arguments = [ @@ -64,10 +64,10 @@ public function testGetIdentity($expectedSum, $cacheTypes) public function getIdentityDataProvider() { - $cacheTypeMock1 = $this->getMock(\stdClass::class, ['getCacheType']); + $cacheTypeMock1 = $this->createPartialMock(\stdClass::class, ['getCacheType']); $cacheTypeMock1->expects($this->any())->method('getCacheType')->will($this->returnValue('Simple')); - $cacheTypeMock2 = $this->getMock(\stdClass::class, ['getCacheType']); + $cacheTypeMock2 = $this->createPartialMock(\stdClass::class, ['getCacheType']); $cacheTypeMock2->expects($this->any())->method('getCacheType')->will($this->returnValue('Advanced')); return [ @@ -97,7 +97,7 @@ public function testIsDisplayed($expected, $allowed, $cacheTypes) public function isDisplayedDataProvider() { - $cacheTypesMock = $this->getMock(\stdClass::class, ['getCacheType']); + $cacheTypesMock = $this->createPartialMock(\stdClass::class, ['getCacheType']); $cacheTypesMock->expects($this->any())->method('getCacheType')->will($this->returnValue('someVal')); $cacheTypes = [$cacheTypesMock, $cacheTypesMock]; return [ diff --git a/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/Media/Synchronization/ErrorTest.php b/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/Media/Synchronization/ErrorTest.php index 42d377c16d90f..2c259db868851 100644 --- a/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/Media/Synchronization/ErrorTest.php +++ b/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/Media/Synchronization/ErrorTest.php @@ -5,7 +5,7 @@ */ namespace Magento\AdminNotification\Test\Unit\Model\System\Message\Media\Synchronization; -class ErrorTest extends \PHPUnit_Framework_TestCase +class ErrorTest extends \PHPUnit\Framework\TestCase { /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -24,9 +24,12 @@ class ErrorTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_syncFlagMock = $this->getMock(\Magento\MediaStorage\Model\File\Storage\Flag::class, [], [], '', false); + $this->_syncFlagMock = $this->createPartialMock( + \Magento\MediaStorage\Model\File\Storage\Flag::class, + ['setState', 'save', 'getFlagData'] + ); - $this->_fileStorage = $this->getMock(\Magento\MediaStorage\Model\File\Storage\Flag::class, [], [], '', false); + $this->_fileStorage = $this->createMock(\Magento\MediaStorage\Model\File\Storage\Flag::class); $this->_fileStorage->expects($this->any())->method('loadSelf')->will($this->returnValue($this->_syncFlagMock)); $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); diff --git a/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/SecurityTest.php b/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/SecurityTest.php index 8a69f7adb0876..1e71570a5e30b 100644 --- a/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/SecurityTest.php +++ b/app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/SecurityTest.php @@ -5,7 +5,7 @@ */ namespace Magento\AdminNotification\Test\Unit\Model\System\Message; -class SecurityTest extends \PHPUnit_Framework_TestCase +class SecurityTest extends \PHPUnit\Framework\TestCase { /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -35,14 +35,11 @@ class SecurityTest extends \PHPUnit_Framework_TestCase protected function setUp() { //Prepare objects for constructor - $this->_cacheMock = $this->getMock(\Magento\Framework\App\CacheInterface::class); - $this->_scopeConfigMock = $this->getMock(\Magento\Framework\App\Config\ScopeConfigInterface::class); - $this->_curlFactoryMock = $this->getMock( + $this->_cacheMock = $this->createMock(\Magento\Framework\App\CacheInterface::class); + $this->_scopeConfigMock = $this->createMock(\Magento\Framework\App\Config\ScopeConfigInterface::class); + $this->_curlFactoryMock = $this->createPartialMock( \Magento\Framework\HTTP\Adapter\CurlFactory::class, - ['create'], - [], - '', - false + ['create'] ); $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); @@ -70,7 +67,7 @@ public function testIsDisplayed($expectedResult, $cached, $response) $this->_cacheMock->expects($this->any())->method('load')->will($this->returnValue($cached)); $this->_cacheMock->expects($this->any())->method('save')->will($this->returnValue(null)); - $httpAdapterMock = $this->getMock(\Magento\Framework\HTTP\Adapter\Curl::class, [], [], '', false); + $httpAdapterMock = $this->createMock(\Magento\Framework\HTTP\Adapter\Curl::class); $httpAdapterMock->expects($this->any())->method('read')->will($this->returnValue($response)); $this->_curlFactoryMock->expects($this->any())->method('create')->will($this->returnValue($httpAdapterMock)); diff --git a/app/code/Magento/AdminNotification/Ui/Component/DataProvider/DataProvider.php b/app/code/Magento/AdminNotification/Ui/Component/DataProvider/DataProvider.php index 835e6733151f5..6fca6ca8e2e7f 100644 --- a/app/code/Magento/AdminNotification/Ui/Component/DataProvider/DataProvider.php +++ b/app/code/Magento/AdminNotification/Ui/Component/DataProvider/DataProvider.php @@ -9,7 +9,8 @@ use Magento\AdminNotification\Model\ResourceModel\System\Message\Collection\SynchronizedFactory; /** - * Class DataProvider + * @api + * @since 100.2.0 */ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider { diff --git a/app/code/Magento/AdminNotification/composer.json b/app/code/Magento/AdminNotification/composer.json index afb820a2e6c93..227837558a8b3 100644 --- a/app/code/Magento/AdminNotification/composer.json +++ b/app/code/Magento/AdminNotification/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-media-storage": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-ui": "100.2.*", + "magento/module-store": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-media-storage": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-ui": "100.3.*", "lib-libxml": "*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/AdminNotification/i18n/en_US.csv b/app/code/Magento/AdminNotification/i18n/en_US.csv index 1afb8104bfef6..16c5abb9db0d2 100644 --- a/app/code/Magento/AdminNotification/i18n/en_US.csv +++ b/app/code/Magento/AdminNotification/i18n/en_US.csv @@ -1,13 +1,13 @@ "Read Details","Read Details" "Mark as Read","Mark as Read" "Are you sure?","Are you sure?" -"Remove","Remove" +Remove,Remove "Messages Inbox","Messages Inbox" "You have %1 new system messages","You have %1 new system messages" "You have %1 new system message","You have %1 new system message" "Incoming Message","Incoming Message" -"close","close" -"Notifications","Notifications" +close,close +Notifications,Notifications "The message has been marked as Read.","The message has been marked as Read." "We couldn't mark the notification as Read because of an error.","We couldn't mark the notification as Read because of an error." "Please select messages.","Please select messages." @@ -20,10 +20,10 @@ "6 Hours","6 Hours" "12 Hours","12 Hours" "24 Hours","24 Hours" -"critical","critical" -"major","major" -"minor","minor" -"notice","notice" +critical,critical +major,major +minor,minor +notice,notice "Wrong message type","Wrong message type" "Wrong notification ID specified.","Wrong notification ID specified." "{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure URL / Base Secure URL. We highly recommend changing this value in your Magento configuration.","{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure URL / Base Secure URL. We highly recommend changing this value in your Magento configuration." @@ -32,12 +32,11 @@ "We were unable to synchronize one or more media files. Please refer to the log file for details.","We were unable to synchronize one or more media files. Please refer to the log file for details." "Synchronization of media storages has been completed.","Synchronization of media storages has been completed." "Your web server is set up incorrectly and allows unauthorized access to sensitive files. Please contact your hosting provider.","Your web server is set up incorrectly and allows unauthorized access to sensitive files. Please contact your hosting provider." -"Close popup","Close popup" -"Close","Close" "System Messages:","System Messages:" "Critical System Messages","Critical System Messages" "Major System Messages","Major System Messages" "System messages","System messages" +Close,Close "See All (","See All (" " unread)"," unread)" "Show Toolbar","Show Toolbar" @@ -45,7 +44,7 @@ "Use HTTPS to Get Feed","Use HTTPS to Get Feed" "Update Frequency","Update Frequency" "Last Update","Last Update" -"Severity","Severity" +Severity,Severity "Date Added","Date Added" -"Message","Message" -"Actions","Actions" +Message,Message +Actions,Actions diff --git a/app/code/Magento/AdminNotification/registration.php b/app/code/Magento/AdminNotification/registration.php index b0e1c4ef1aa44..8d427a458c18d 100644 --- a/app/code/Magento/AdminNotification/registration.php +++ b/app/code/Magento/AdminNotification/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_AdminNotification', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_AdminNotification', __DIR__); diff --git a/app/code/Magento/AdminNotification/view/adminhtml/templates/notification/window.phtml b/app/code/Magento/AdminNotification/view/adminhtml/templates/notification/window.phtml index c6b8bda208410..3f79e803ccca2 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/templates/notification/window.phtml +++ b/app/code/Magento/AdminNotification/view/adminhtml/templates/notification/window.phtml @@ -19,11 +19,11 @@ "autoOpen": true, "buttons": false, "modalClass": "modal-system-messages", - "title": "getHeaderText(); ?>" + "title": "getHeaderText() ?>" } }'>
  • - getNoticeMessageText(); ?>
    - getReadDetailsText(); ?> + getNoticeMessageText() ?>
    + getReadDetailsText() ?>
  • diff --git a/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages.phtml b/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages.phtml index 4e8be1fee7658..01d6fdcb29571 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages.phtml +++ b/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages.phtml @@ -15,31 +15,31 @@
    • - getText();?> + getText() ?>
    -
    +
    diff --git a/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml b/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml index 624f4d35fee1c..a97293547e132 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml +++ b/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml @@ -9,11 +9,11 @@ ?> -