-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
757b60c
commit eab865c
Showing
60 changed files
with
2,535 additions
and
786 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ on: [pull_request] | |
|
||
jobs: | ||
validate-tests: | ||
name: Run Tests | ||
runs-on: ubuntu-22.04 | ||
|
||
services: | ||
|
@@ -59,14 +60,53 @@ jobs: | |
|
||
- name: Run Unit Test | ||
id: unit-test | ||
run: magento2/vendor/phpunit/phpunit/phpunit --configuration magento2/app/code/MercadoPago/AdbPayment/phpunit.xml --coverage-clover clover.xml --coverage-text magento2/app/code/MercadoPago/AdbPayment/Tests | ||
run: | ||
XDEBUG_MODE=coverage magento2/vendor/phpunit/phpunit/phpunit \ | ||
--configuration magento2/app/code/MercadoPago/AdbPayment/phpunit.xml \ | ||
--coverage-html coverage/ \ | ||
--coverage-clover coverage/clover.xml \ | ||
--coverage-filter magento2/app/code/MercadoPago/AdbPayment | ||
|
||
- name: Repository Minimum Test Coverage | ||
id: repository-coverage | ||
run: php magento2/app/code/MercadoPago/AdbPayment/Tests/coverage-checker.php clover.xml 80 | ||
run: php magento2/app/code/MercadoPago/AdbPayment/Tests/coverage-checker.php coverage/clover.xml 25 | ||
|
||
- id: pr-files-list | ||
name: Get Pull Request Files | ||
uses: ruslandulina/[email protected] | ||
|
||
- id: save-modified-pr-files-list | ||
name: Save modified PR Files List to a file | ||
run: echo "${{join(steps.pr-files-list.outputs.modified, ' ')}}" > modified-files-list.txt | ||
|
||
- id: save-added-pr-files-list | ||
name: Save added PR Files List to a file | ||
run: echo "${{join(steps.pr-added-list.outputs.added, ' ')}}" > added-files-list.txt | ||
|
||
- name: PR Modified Files | ||
run: cat modified-files-list.txt | ||
|
||
- name: PR Added Files | ||
run: cat added-files-list.txt | ||
|
||
- name: Pull Request Coverage | ||
id: pull-request-coverage | ||
run: bash bin/pull-request-coverage.sh | ||
env: | ||
PR_NUMBER: ${{ github.event.number }} | ||
run: php magento2/app/code/MercadoPago/AdbPayment/Tests/pr-coverage.php coverage/clover.xml modified-files-list.txt added-files-list.txt 25 | ||
|
||
- name: List | ||
run: ls && ls coverage | ||
|
||
- name: ZIP coverage results | ||
run: zip coverage.zip coverage | ||
|
||
- name: Archive code coverage results | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: code-coverage-report | ||
path: coverage.zip | ||
|
||
- name: Archive code coverage folder | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: code-coverage-report | ||
path: coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ vendor | |
.phpunit.result.cache | ||
testdoc.txt | ||
.idea | ||
coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © MercadoPago. All rights reserved. | ||
* | ||
* @author Mercado Pago | ||
* @license See LICENSE for license details. | ||
*/ | ||
|
||
namespace MercadoPago\AdbPayment\Block\Sales\Info; | ||
|
||
use Magento\Payment\Block\ConfigurableInfo; | ||
use Magento\Framework\Stdlib\DateTime\TimezoneInterface; | ||
use Magento\Framework\Pricing\PriceCurrencyInterface; | ||
use Magento\Framework\View\Element\Template\Context; | ||
use Magento\Payment\Gateway\ConfigInterface; | ||
|
||
/** | ||
* Payment details form block. | ||
* | ||
* @SuppressWarnings(PHPMD.CamelCasePropertyName) | ||
*/ | ||
class Info extends ConfigurableInfo | ||
{ | ||
private TimezoneInterface $timezone; | ||
|
||
/** @var PriceCurrencyInterface $priceCurrency */ | ||
protected $priceCurrency; | ||
|
||
/** | ||
* @param Context $context | ||
* @param ConfigInterface $config | ||
* @param TimezoneInterface $timezone | ||
* @param PriceCurrencyInterface $priceCurrency | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
ConfigInterface $config, | ||
TimezoneInterface $timezone, | ||
PriceCurrencyInterface $priceCurrency, | ||
array $data = [] | ||
) { | ||
parent::__construct($context, $config, $data); | ||
$this->timezone = $timezone; | ||
$this->priceCurrency = $priceCurrency; | ||
} | ||
|
||
/** | ||
* Function FormatedDate | ||
* | ||
* @param string $date | ||
* | ||
* @return string | ||
*/ | ||
public function date($date) | ||
{ | ||
$localeDate = $this->timezone->date($date); | ||
|
||
$format = $localeDate->format('Y-m-d\TH:i:s.000O'); | ||
|
||
|
||
return $this->formatDate( | ||
$format, | ||
\IntlDateFormatter::MEDIUM, | ||
true, | ||
); | ||
} | ||
|
||
/** | ||
* Function getFormatedPrice | ||
* | ||
* @param float $price | ||
* | ||
* @return string | ||
*/ | ||
public function getFormatedPrice($amount) | ||
{ | ||
return $this->priceCurrency->convertAndFormat($amount); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.