Skip to content

Commit 85def59

Browse files
authored
Merge pull request #1134 from magento-engcom/develop-prs
[EngCom] Public Pull Requests
2 parents 076d199 + 372ea50 commit 85def59

File tree

16 files changed

+297
-22
lines changed

16 files changed

+297
-22
lines changed

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ addons:
77
- mysql-client-core-5.6
88
- mysql-client-5.6
99
- postfix
10+
firefox: "46.0"
11+
hosts:
12+
- magento2.travis
1013
language: php
1114
php:
1215
- 7.0
@@ -16,19 +19,26 @@ env:
1619
- COMPOSER_BIN_DIR=~/bin
1720
- INTEGRATION_SETS=3
1821
- NODE_JS_VERSION=6
22+
- MAGENTO_HOST_NAME="magento2.travis"
1923
matrix:
2024
- TEST_SUITE=unit
2125
- TEST_SUITE=integration INTEGRATION_INDEX=1
2226
- TEST_SUITE=integration INTEGRATION_INDEX=2
2327
- TEST_SUITE=integration INTEGRATION_INDEX=3
2428
- TEST_SUITE=static
2529
- TEST_SUITE=js
30+
- TEST_SUITE=functional ACCEPTANCE_INDEX=1
31+
- TEST_SUITE=functional ACCEPTANCE_INDEX=2
2632
matrix:
2733
exclude:
2834
- php: 7.0
2935
env: TEST_SUITE=static
3036
- php: 7.0
3137
env: TEST_SUITE=js
38+
- php: 7.0
39+
env: TEST_SUITE=functional ACCEPTANCE_INDEX=1
40+
- php: 7.0
41+
env: TEST_SUITE=functional ACCEPTANCE_INDEX=2
3242
cache:
3343
apt: true
3444
directories:

app/code/Magento/Cookie/Helper/Cookie.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,22 @@ public function __construct(
7070
public function isUserNotAllowSaveCookie()
7171
{
7272
$acceptedSaveCookiesWebsites = $this->_getAcceptedSaveCookiesWebsites();
73+
return $this->isCookieRestrictionModeEnabled() &&
74+
empty($acceptedSaveCookiesWebsites[$this->_website->getId()]);
75+
}
76+
77+
/**
78+
* Check if cookie restriction mode is enabled for this store
79+
*
80+
* @return bool
81+
*/
82+
public function isCookieRestrictionModeEnabled()
83+
{
7384
return $this->scopeConfig->getValue(
7485
self::XML_PATH_COOKIE_RESTRICTION,
7586
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
7687
$this->_currentStore
77-
) && empty($acceptedSaveCookiesWebsites[$this->_website->getId()]);
88+
);
7889
}
7990

8091
/**

app/code/Magento/Cookie/view/frontend/templates/html/notices.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/** @var \Magento\Cookie\Block\Html\Notices $block */
1010
?>
11-
<?php if ($this->helper(\Magento\Cookie\Helper\Cookie::class)->isUserNotAllowSaveCookie()): ?>
11+
<?php if ($this->helper(\Magento\Cookie\Helper\Cookie::class)->isCookieRestrictionModeEnabled()): ?>
1212
<div role="alertdialog"
1313
tabindex="-1"
1414
class="message global cookie"

app/code/Magento/Cookie/view/frontend/web/js/notices.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ define([
2424
$(this.options.cookieAllowButtonSelector).on('click', $.proxy(function () {
2525
var cookieExpires = new Date(new Date().getTime() + this.options.cookieLifetime * 1000);
2626

27-
$.mage.cookies.set(this.options.cookieName, this.options.cookieValue, {
27+
$.mage.cookies.set(this.options.cookieName, JSON.stringify(this.options.cookieValue), {
2828
expires: cookieExpires
2929
});
3030

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
// @codingStandardsIgnoreFile
8+
/**
9+
* @see \Magento\Payment\Block\Info
10+
* @var \Magento\Payment\Block\Info $block
11+
*/
12+
?>
13+
<?php echo $block->escapeHtml($block->getMethod()->getTitle()); ?>{{pdf_row_separator}}
14+
15+
<?php if ($specificInfo = $block->getSpecificInformation()):?>
16+
<?php foreach ($specificInfo as $label => $value):?>
17+
<?php echo $block->escapeHtml($label) ?>:
18+
<?php echo $block->escapeHtml(implode(' ', $block->getValueAsArray($value)));?>
19+
{{pdf_row_separator}}
20+
<?php endforeach; ?>
21+
<?php endif;?>
22+
23+
<?php echo $block->escapeHtml(implode('{{pdf_row_separator}}', $block->getChildPdfAsArray())); ?>

app/code/Magento/Sales/Model/Order/Config.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,10 @@ public function getInvisibleOnFrontStatuses()
250250
*/
251251
protected function _getStatuses($visibility)
252252
{
253-
if ($this->statuses == null) {
253+
if ($this->statuses === null) {
254+
255+
$this->statuses = [ true => [], false => [] ];
256+
254257
foreach ($this->_getCollection() as $item) {
255258
$visible = (bool) $item->getData('visible_on_front');
256259
$this->statuses[$visible][] = $item->getData('status');

app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,8 @@ define([
12481248
params.store_id = this.storeId;
12491249
}
12501250

1251-
var currentCustomerGroupId = $(parameters.groupIdHtmlId).value;
1251+
var currentCustomerGroupId = $(parameters.groupIdHtmlId)
1252+
? $(parameters.groupIdHtmlId).value : '';
12521253

12531254
new Ajax.Request(parameters.validateUrl, {
12541255
parameters: params,

dev/tests/functional/phpunit.xml.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
</listeners>
3030

3131
<php>
32-
<env name="app_frontend_url" value="http://localhost/" />
33-
<env name="app_backend_url" value="http://localhost/backend/" />
32+
<env name="app_frontend_url" value="http://127.0.0.1/" />
33+
<env name="app_backend_url" value="http://127.0.0.1/backend/" />
3434
<env name="testsuite_rule" value="basic" />
3535
<env name="testsuite_rule_path" value="Magento/Mtf/TestSuite/InjectableTests" />
3636
<env name="log_directory" value="var/log" />
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../vendor/magento/mtf/Magento/Mtf/TestRunner/etc/testRunner.xsd">
10+
<rule scope="testsuite">
11+
<allow>
12+
<module value="Magento_AdminNotification" strict="1" />
13+
<module value="Magento_AdvancedPricingImportExport" strict="1" />
14+
<module value="Magento_Analytics" strict="1" />
15+
<module value="Magento_Authorizenet" strict="1" />
16+
<module value="Magento_Backend" strict="1" />
17+
<module value="Magento_Backup" strict="1" />
18+
<module value="Magento_Braintree" strict="1" />
19+
<module value="Magento_Bundle" strict="1" />
20+
<module value="Magento_BundleImportExport" strict="1" />
21+
<module value="Magento_Captcha" strict="1" />
22+
<module value="Magento_Catalog" strict="1" />
23+
<module value="Magento_CatalogImportExport" strict="1" />
24+
<module value="Magento_CatalogInventory" strict="1" />
25+
<module value="Magento_CatalogInventoryConfigurableProduct" strict="1" />
26+
<module value="Magento_CatalogRule" strict="1" />
27+
<module value="Magento_CatalogRuleConfigurable" strict="1" />
28+
<module value="Magento_CatalogSearch" strict="1" />
29+
<module value="Magento_CatalogUrlRewrite" strict="1" />
30+
<module value="Magento_CheckoutAgreements" strict="1" />
31+
<module value="Magento_Cms" strict="1" />
32+
<module value="Magento_Config" strict="1" />
33+
<module value="Magento_ConfigurableImportExport" strict="1" />
34+
<module value="Magento_Contact" strict="1" />
35+
<module value="Magento_CurrencySymbol" strict="1" />
36+
<module value="Magento_Customer" strict="1" />
37+
<module value="Magento_CustomerImportExport" strict="1" />
38+
<module value="Magento_Dhl" strict="1" />
39+
<module value="Magento_Directory" strict="1" />
40+
<module value="Magento_Downloadable" strict="1" />
41+
<module value="Magento_Email" strict="1" />
42+
<module value="Magento_Fedex" strict="1" />
43+
<module value="Magento_GiftMessage" strict="1" />
44+
<module value="Magento_GroupedImportExport" strict="1" />
45+
<module value="Magento_GroupedProduct" strict="1" />
46+
<module value="Magento_ImportExport" strict="1" />
47+
<module value="Magento_Indexer" strict="1" />
48+
<module value="Magento_Install" strict="1" />
49+
<module value="Magento_Integration" strict="1" />
50+
</allow>
51+
</rule>
52+
<rule scope="testcase">
53+
<allow>
54+
<tag group="test_type" value="acceptance_test" />
55+
</allow>
56+
<deny>
57+
<tag group="stable" value="no" />
58+
</deny>
59+
</rule>
60+
<rule scope="variation">
61+
<allow>
62+
<tag group="test_type" value="acceptance_test" />
63+
</allow>
64+
<deny>
65+
<tag group="stable" value="no" />
66+
</deny>
67+
</rule>
68+
</config>
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../vendor/magento/mtf/Magento/Mtf/TestRunner/etc/testRunner.xsd">
10+
<rule scope="testsuite">
11+
<allow>
12+
<module value="Magento_ConfigurableProduct" strict="1" />
13+
<module value="Magento_Checkout" strict="1" />
14+
<module value="Magento_LayeredNavigation" strict="1" />
15+
<module value="Magento_Msrp" strict="1" />
16+
<module value="Magento_Multishipping" strict="1" />
17+
<module value="Magento_Newsletter" strict="1" />
18+
<module value="Magento_OfflinePayments" strict="1" />
19+
<module value="Magento_OfflineShipping" strict="1" />
20+
<module value="Magento_PageCache" strict="1" />
21+
<module value="Magento_Payment" strict="1" />
22+
<module value="Magento_Paypal" strict="1" />
23+
<module value="Magento_Persistent" strict="1" />
24+
<module value="Magento_ProductVideo" strict="1" />
25+
<module value="Magento_Reports" strict="1" />
26+
<module value="Magento_Review" strict="1" />
27+
<module value="Magento_Sales" strict="1" />
28+
<module value="Magento_SalesRule" strict="1" />
29+
<module value="Magento_Search" strict="1" />
30+
<module value="Magento_Security" strict="1" />
31+
<module value="Magento_Setup" strict="1" />
32+
<module value="Magento_Shipping" strict="1" />
33+
<module value="Magento_Sitemap" strict="1" />
34+
<module value="Magento_Store" strict="1" />
35+
<module value="Magento_Swagger" strict="1" />
36+
<module value="Magento_Swatches" strict="1" />
37+
<module value="Magento_Tax" strict="1" />
38+
<module value="Magento_Theme" strict="1" />
39+
<module value="Magento_Ui" strict="1" />
40+
<module value="Magento_Ups" strict="1" />
41+
<module value="Magento_UrlRewrite" strict="1" />
42+
<module value="Magento_User" strict="1" />
43+
<module value="Magento_Usps" strict="1" />
44+
<module value="Magento_Variable" strict="1" />
45+
<module value="Magento_Vault" strict="1" />
46+
<module value="Magento_Weee" strict="1" />
47+
<module value="Magento_Widget" strict="1" />
48+
<module value="Magento_Wishlist" strict="1" />
49+
</allow>
50+
</rule>
51+
<rule scope="testcase">
52+
<allow>
53+
<tag group="test_type" value="acceptance_test" />
54+
</allow>
55+
<deny>
56+
<tag group="stable" value="no" />
57+
</deny>
58+
</rule>
59+
<rule scope="variation">
60+
<allow>
61+
<tag group="test_type" value="acceptance_test" />
62+
</allow>
63+
<deny>
64+
<tag group="stable" value="no" />
65+
</deny>
66+
</rule>
67+
</config>

dev/travis/before_install.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,31 @@ if [ $TEST_SUITE = "static" ] || [ test $TEST_SUITE == "js" ]; then
3333
npm install -g yarn
3434
yarn global add grunt-cli
3535
fi
36+
37+
if [ $TEST_SUITE = "functional" ]; then
38+
# Install apache
39+
sudo apt-get update
40+
sudo apt-get install apache2 libapache2-mod-fastcgi
41+
if [ ${TRAVIS_PHP_VERSION:0:1} == "7" ]; then
42+
sudo cp ${TRAVIS_BUILD_DIR}/dev/travis/config/www.conf ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/
43+
fi
44+
45+
# Enable php-fpm
46+
sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
47+
sudo a2enmod rewrite actions fastcgi alias
48+
echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
49+
~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
50+
51+
# Configure apache virtual hosts
52+
sudo cp -f ${TRAVIS_BUILD_DIR}/dev/travis/config/apache_virtual_host /etc/apache2/sites-available/000-default.conf
53+
sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
54+
sudo sed -e "s?%MAGENTO_HOST_NAME%?${MAGENTO_HOST_NAME}?g" --in-place /etc/apache2/sites-available/000-default.conf
55+
56+
sudo usermod -a -G www-data travis
57+
sudo usermod -a -G travis www-data
58+
59+
phpenv config-rm xdebug.ini
60+
sudo service apache2 restart
61+
62+
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -screen 0 1280x1024x24
63+
fi

dev/travis/before_script.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,39 @@ case $TEST_SUITE in
9292
echo "Deploying Static Content"
9393
php bin/magento setup:static-content:deploy -f -q -j=2 --no-css --no-less --no-images --no-fonts --no-misc --no-html-minify
9494
;;
95+
functional)
96+
echo "Installing Magento"
97+
mysql -uroot -e 'CREATE DATABASE magento2;'
98+
php bin/magento setup:install -q \
99+
--language="en_US" \
100+
--timezone="UTC" \
101+
--currency="USD" \
102+
--base-url="http://${MAGENTO_HOST_NAME}/" \
103+
--admin-firstname="John" \
104+
--admin-lastname="Doe" \
105+
--backend-frontname="backend" \
106+
--admin-email="[email protected]" \
107+
--admin-user="admin" \
108+
--use-rewrites=1 \
109+
--admin-use-security-key=0 \
110+
--admin-password="123123q"
111+
112+
echo "Enabling production mode"
113+
php bin/magento deploy:mode:set production
114+
115+
echo "Prepare functional tests for running"
116+
cd dev/tests/functional
117+
118+
composer install && composer require se/selenium-server-standalone:2.53.1
119+
export DISPLAY=:1.0
120+
sh ./vendor/se/selenium-server-standalone/bin/selenium-server-standalone -port 4444 -host 127.0.0.1 -Dwebdriver.firefox.bin=$(which firefox) -trustAllSSLCertificate &> ~/selenium.log &
121+
cp ./phpunit.xml.dist ./phpunit.xml
122+
sed -e "s?127.0.0.1?${MAGENTO_HOST_NAME}?g" --in-place ./phpunit.xml
123+
sed -e "s?basic?travis_acceptance_${ACCEPTANCE_INDEX}?g" --in-place ./phpunit.xml
124+
cp ./.htaccess.sample ./.htaccess
125+
cd ./utils
126+
php -f mtf troubleshooting:check-all
127+
128+
cd ../../..
129+
;;
95130
esac

dev/travis/config/apache_virtual_host

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<VirtualHost *:80>
2+
DocumentRoot %TRAVIS_BUILD_DIR%
3+
ServerName %MAGENTO_HOST_NAME%
4+
5+
<Directory "%TRAVIS_BUILD_DIR%">
6+
Options FollowSymLinks MultiViews ExecCGI
7+
AllowOverride All
8+
Require all granted
9+
</Directory>
10+
11+
<IfModule mod_fastcgi.c>
12+
AddHandler php7-fcgi .php
13+
Action php7-fcgi /php7-fcgi
14+
Alias /php7-fcgi /usr/lib/cgi-bin/php7-fcgi
15+
FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi -host 127.0.0.1:9000 -pass-header Authorization
16+
<Directory /usr/lib/cgi-bin>
17+
Require all granted
18+
</Directory>
19+
</IfModule>
20+
</VirtualHost>

dev/travis/config/www.conf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[www]
2+
3+
user = www-data
4+
group = www-data
5+
6+
listen = 127.0.0.1:9000
7+
8+
pm = dynamic
9+
pm.max_children = 10
10+
pm.start_servers = 4
11+
pm.min_spare_servers = 2
12+
pm.max_spare_servers = 6
13+
14+
chdir = /

dev/travis/script.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ case $TEST_SUITE in
1212
js)
1313
grunt spec
1414
;;
15+
functional)
16+
cd dev/tests/functional
17+
vendor/phpunit/phpunit/phpunit -c phpunit.xml --debug testsuites/Magento/Mtf/TestSuite/InjectableTests.php
18+
;;
1519
*)
1620
phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER;
1721
;;

0 commit comments

Comments
 (0)