Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nx work new #11

Open
wants to merge 14 commits into
base: nx-work
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 136 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: Unit Tests
run-name: ${{ github.actor }} is running Unit Tests
on:
pull_request:
branches:
- 2.4-develop
- nx-work

permissions:
contents: write

jobs:
run-unit-tests:
uses: adamzero1/mage-os-infrastructure/.github/workflows/unit-tests.yml@nx-unit-testing

# name: Unit Tests
# run-name: ${{ github.actor }} is running Unit Tests
# on:
# pull_request:
# branches:
# - 2.4-develop
# - nx-work

# permissions:
# contents: write

# jobs:
# unit-tests:
# strategy:
# fail-fast: false
# matrix:
# php_version: [8.1,8.2]
# runs-on: ubuntu-latest
# steps:
# - name: Checkout PR commit
# uses: actions/checkout@v3
# with:
# ref: ${{ github.event.pull_request.head.sha }}
# path: main
# # Need to do this otherwise Nx cant determine diff
# fetch-depth: 0

# - name: Fetch base
# working-directory: ./main
# run: git fetch origin ${{ github.event.pull_request.base.ref }}

# - name: Install Composer
# uses: php-actions/composer@v6
# with:
# # Run the dummy help command after installing Composer (otherwise defaults to install)
# command: help

# - name: Get Composer Cache Directory
# id: composer-cache
# working-directory: ./main
# run: echo "composer_cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

# - name: Install Composer Cache
# uses: actions/cache@v3
# with:
# path: ${{ steps.composer-cache.outputs.composer_cache_dir }}
# key: ${{ runner.os }}-composer-${{ hashFiles('**/main/composer.lock') }}
# restore-keys: |
# ${{ runner.os }}-composer-
# - name: Install Composer Dependencies
# working-directory: ./main
# run: composer install

# - name: Checkout Nx Repo
# uses: actions/checkout@v3
# with:
# repository: adamzero1/nx-for-php
# ref: docker-wrapper
# path: nx

# - name: Install / setup Nx
# working-directory: ./main
# run: |
# npm install -g nx@15.4.1
# NXDIR="../nx"
# cp -r ${NXDIR}/nx ./
# cp ${NXDIR}/nx.json ./
# cp ${NXDIR}/package.json ./
# cp ${NXDIR}/package-lock.json ./
# npm ci
# npm run generate-workspace
# - name: Print Affected
# working-directory: ./main
# run: |
# AFFECTED_OUTPUT=/tmp/affect.json
# nx print-affected --head=HEAD --base=remotes/origin/${{ github.event.pull_request.base.ref }} > ${AFFECTED_OUTPUT}
# echo "Affected Projects: $(jq .projects ${AFFECTED_OUTPUT})"

# # Warden / Den stuff
# - name: Checkout Den Repo
# uses: actions/checkout@v3
# with:
# repository: swiftotter/den
# path: den

# - name: Init / Configure Den
# working-directory: ./main
# run: |
# DEN=/home/runner/work/magento2/magento2/den/bin/den
# ${DEN} env-init magento2 magento2
# sed -i 's/WARDEN_DB=.*/WARDEN_DB=0/g' .env
# sed -i 's/WARDEN_TEST_DB=.*/WARDEN_TEST_DB=0/g' .env
# sed -i 's/WARDEN_ELASTICSEARCH=.*/WARDEN_ELASTICSEARCH=0/g' .env
# sed -i 's/WARDEN_OPENSEARCH=.*/WARDEN_OPENSEARCH=0/g' .env
# sed -i 's/WARDEN_ELASTICHQ=.*/WARDEN_ELASTICHQ=0/g' .env
# sed -i 's/WARDEN_VARNISH=.*/WARDEN_VARNISH=0/g' .env
# sed -i 's/WARDEN_RABBITMQ=.*/WARDEN_RABBITMQ=0/g' .env
# sed -i 's/WARDEN_REDIS=.*/WARDEN_REDIS=0/g' .env
# sed -i 's/PHP_VERSION=.*/PHP_VERSION=${{ matrix.php_version }}/g' .env
# ${DEN} env up
# echo ${{secrets.DEPLOY_PASSWORD}} | sudo -S chmod -R a+rw .
# # # Unit test command test
# # - name: Run PHPUnit
# # working-directory: ./main
# # run: |
# # DEN=/home/runner/work/magento2/magento2/den/bin/den
# # ${DEN} env exec -T php-fpm ./vendor/bin/phpunit --help
# # ${DEN} env exec -T php-fpm whoami
# # ${DEN} env exec -T php-fpm ls -lath

# - name: Configure PHPUnit
# working-directory: ./main
# run: |
# cp dev/tests/unit/phpunit.xml.dist dev/tests/unit/phpunit.xml
# sed -i '/<extensions>/,/<\/extensions>/d' dev/tests/unit/phpunit.xml

# - name: Run PHPUnit Nx
# working-directory: ./main
# run: |
# export DEN=/home/runner/work/magento2/magento2/den/bin/den
# nx affected --target=test:unit --head=HEAD --base=remotes/origin/${{ github.event.pull_request.base.ref }}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class CanViewNotification implements VisibilityConditionInterface
private static $cachePrefix = 'admin-usage-notification-popup';

/**
* aaaaaa
* @var Logger
*/
private $viewerLogger;
Expand Down
16 changes: 8 additions & 8 deletions app/code/Magento/Directory/Test/Unit/Model/CurrencyTest.php
Copy link
Owner Author

@adamzero1 adamzero1 Apr 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding right to left mark's, which PHPs \NumberFormatter is automatically adding in response.
([U+200F])

Given the involved files haven't been modified in a long time:

  • app/code/Magento/Directory/Model/Currency.php 9 months
  • app/code/Magento/Directory/Test/Unit/Model/CurrencyTest.php 6 Months
  • lib/internal/Magento/Framework/NumberFormatter.php 2 years

I can only guess this is PHP version thing or, has always been here?
magento@91816f7
Even though the comment is incorrect, this commit must of been the start. (n.b reverting this doesn't fix the issue)

Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ public function getOutputFormatDataProvider(): array
'en_US:PLN' => ['en_US', 'PLN', "PLN\u{00A0}%s"],
'en_US:PKR' => ['en_US', 'PKR', "PKR\u{00A0}%s"],
'af_ZA:VND' => ['af_ZA', 'VND', "\u{20AB}%s"],
'ar_DZ:EGP' => ['ar_DZ', 'EGP', "\u{062C}.\u{0645}.\u{200F}\u{00A0}%s"],
'ar_SA:USD' => ['ar_SA', 'USD', "%s\u{00A0}US$"],
'ar_SA:LBP' => ['ar_SA', 'LBP', "%s\u{00A0}\u{0644}.\u{0644}.\u{200F}"],
'ar_DZ:EGP' => ['ar_DZ', 'EGP', "\u{200F}%s\u{00A0}\u{062C}.\u{0645}.\u{200F}"],
'ar_SA:USD' => ['ar_SA', 'USD', "\u{200F}%s\u{00A0}US$"],
'ar_SA:LBP' => ['ar_SA', 'LBP', "\u{200F}%s\u{00A0}\u{0644}.\u{0644}.\u{200F}"],
'fa_IR:USD' => ['fa_IR', 'USD', "\u{200E}$%s"],
'ar_KW:USD' => ['ar_KW', 'USD', "%s\u{00A0}US$"],
'ar_KW:USD' => ['ar_KW', 'USD', "\u{200F}%s\u{00A0}US$"],
'bn_BD:IQD' => ['bn_BD', 'IQD', "%s\u{00A0}IQD"],
'ca_ES:VND' => ['ca_ES', 'VND', "%s\u{00A0}\u{20AB}"],
'de_DE:USD' => ['de_DE', 'USD', "%s\u{00A0}$"],
Expand Down Expand Up @@ -205,8 +205,8 @@ public function getFormatTxtNumberFormatterDataProvider(): array
['en_US', 'USD', '9999', [], '$9,999.00'],
['en_US', 'EUR', '9999', [], '€9,999.00'],
['en_US', 'LBP', '9999', [], "LBP\u{00A0}9,999"],
['ar_SA', 'USD', '9', [], "\u{0669}\u{066B}\u{0660}\u{0660}\u{00A0}US$"],
['ar_SA', 'AED', '9', [], "\u{0669}\u{066B}\u{0660}\u{0660}\u{00A0}\u{062F}.\u{0625}.\u{200F}"],
['ar_SA', 'USD', '9', [], "\u{200F}\u{0669}\u{066B}\u{0660}\u{0660}\u{00A0}US$"],
['ar_SA', 'AED', '9', [], "\u{200F}\u{0669}\u{066B}\u{0660}\u{0660}\u{00A0}\u{062F}.\u{0625}.\u{200F}"],
['de_DE', 'USD', '9999', [], "9.999,00\u{00A0}$"],
['de_DE', 'EUR', '9999', [], "9.999,00\u{00A0}€"],
['en_US', 'USD', '9999', ['display' => CurrencyData::NO_SYMBOL, 'precision' => 2], '9,999.00'],
Expand All @@ -218,14 +218,14 @@ public function getFormatTxtNumberFormatterDataProvider(): array
'USD',
'9999',
['display' => CurrencyData::NO_SYMBOL],
"\u{0669}\u{066C}\u{0669}\u{0669}\u{0669}\u{066B}\u{0660}\u{0660}"
"\u{200F}\u{0669}\u{066C}\u{0669}\u{0669}\u{0669}\u{066B}\u{0660}\u{0660}"
],
[
'ar_SA',
'AED',
'9999',
['display' => CurrencyData::NO_SYMBOL],
"\u{0669}\u{066C}\u{0669}\u{0669}\u{0669}\u{066B}\u{0660}\u{0660}"
"\u{200F}\u{0669}\u{066C}\u{0669}\u{0669}\u{0669}\u{066B}\u{0660}\u{0660}"
],
['en_US', 'USD', ' 9999', ['display' => CurrencyData::NO_SYMBOL], '9,999.00'],
['en_US', 'USD', '9999', ['precision' => 1], '$9,999.0'],
Expand Down
8 changes: 8 additions & 0 deletions supported-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"services": {
"php": [
8.1,
8.2
]
}
}