Skip to content

Unit Tests failed #21001

Closed
Closed
@azngeek

Description

@azngeek

Summary

The unit tests fails for the FormatTests.

Environment

PHP 7.2.14 (cli) (built: Jan 22 2019 22:37:37) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.14, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.6.1, Copyright (c) 2002-2018, by Derick Rethans

Preconditions (*)

  1. magento/project-enterprise-edition 2.3.0
  2. Dockerfile using PHP 7.2 and all required extensions
FROM php:7.2-fpm

# Install dependencies
RUN apt-get update \
  && apt-get install -y \
    libfreetype6-dev \
    libicu-dev \
    libjpeg62-turbo-dev \
    libmcrypt-dev \
    libpng-dev \
    libxslt1-dev \
    sendmail-bin \
    sendmail \
    sudo \
    wget

# Configure the gd library
RUN docker-php-ext-configure \
  gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/

# Install required PHP extensions
RUN docker-php-ext-install dom gd intl mbstring pdo_mysql xsl zip bcmath soap sockets opcache

RUN pecl install -o -f xdebug


###############################
# z.sh                        #
###############################
RUN wget --no-check-certificate https://raw.github.com/rupa/z/master/z.sh -O /usr/local/bin/z.sh && \
chmod +x /usr/local/bin/z.sh && \
echo '. /usr/local/bin/z.sh' >> /root/.bashrc

###############################
# codecept.phar                #
###############################
RUN curl -sL http://codeception.com/codecept.phar -o /usr/local/bin/codecept \
    && chmod +x /usr/local/bin/codecept

# magerun.phar                #
###############################
RUN curl -sL https://files.magerun.net/n98-magerun2.phar -o /usr/local/bin/magerun \
    && chmod +x /usr/local/bin/magerun



#ADD ./conf.d/mothership.ini /usr/local/etc/php/conf.d/mothership.ini
#ADD ./conf.d/sendmail.ini /usr/local/etc/php/conf.d/sendmail.ini
#ADD ./etc/ssmtp/ssmtp.conf /etc/ssmtp/ssmtp.conf

#RUN apk del .build-deps && \
#    rm -rf /tmp/*

RUN apt-get install -y locales locales-all
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8

WORKDIR /var/www/share/dev/

Steps to reproduce (*)

  1. Launch Container and mount Magento with all dependencies to /var/www/share/dev/htdocs/www/
  2. Change directory und run tests in container
cd /var/www/share/dev/htdocs/www/vendor/magento/framework/Locale/Test/Unit
 /var/www/share/dev/htdocs/www/./vendor/phpunit/phpunit/phpunit FormatTest.php

Expected result (*)

  1. Unit Test should run

Actual result (*)

  1. Unit Test fails
3) Magento\Framework\Locale\Test\Unit\FormatTest::testGetPriceFormat with data set #1 ('de_DE', array(',', '.'))
Failed asserting that actual size 0 matches expected size 2.

/var/www/share/dev/htdocs/www/vendor/magento/framework/Locale/Test/Unit/FormatTest.php:82

4) Magento\Framework\Locale\Test\Unit\FormatTest::testGetPriceFormat with data set #2 ('de_CH', array('.', '''))
Failed asserting that actual size 1 matches expected size 2.

/var/www/share/dev/htdocs/www/vendor/magento/framework/Locale/Test/Unit/FormatTest.php:82

5) Magento\Framework\Locale\Test\Unit\FormatTest::testGetPriceFormat with data set #3 ('uk_UA', array(',', ' '))
Failed asserting that actual size 0 matches expected size 2.

Observations

From what i can see right now the error occurs in the class \Magento\Framework\Locale\Magento\Framework\Locale. If i remove the part with "@Currency=' . $currency->getCode()", the tests will pass. It might be an issue with icu.

    /**
     * Returns an array with price formatting info
     *
     * @param string $localeCode Locale code.
     * @param string $currencyCode Currency code.
     * @return array
     */
    public function getPriceFormat($localeCode = null, $currencyCode = null)
    {
        $localeCode = $localeCode ?: $this->_localeResolver->getLocale();
        if ($currencyCode) {
            $currency = $this->currencyFactory->create()->load($currencyCode);
        } else {
            $currency = $this->_scopeResolver->getScope()->getCurrentCurrency();
        }

        $formatter = new \NumberFormatter(
            $localeCode . '@currency=' . $currency->getCode(),
            \NumberFormatter::CURRENCY
        );
        $format = $formatter->getPattern();

ICU Details

/var/www/share/dev/htdocs/www$ php -i |grep ICU
ICU version => 57.1
ICU Data version => 57.1
ICU TZData version => 2016b
ICU Unicode version => 8.0

Metadata

Metadata

Assignees

Labels

Component: StaticTestEvent: snowdog-ossFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions