Skip to content

Commit

Permalink
Finish upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Nov 13, 2023
2 parents 2e8a3ae + 9ebaac4 commit d9cc7d4
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 31 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,23 @@ name: CI

on:
push:
branches:
- 4.x
pull_request:
branches:
- '*'
workflow_dispatch:

jobs:
testsuite:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
php-version: ['8.1', '8.2']
php-version: ['8.1', '8.3']
prefer-lowest: ['']
include:
- php-version: '8.1'
prefer-lowest: 'prefer-lowest'

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -59,7 +56,7 @@ jobs:
- name: Run PHPUnit
run: |
if [[ ${{ matrix.php-version }} == '8.1' ]]; then
export CODECOVERAGE=1 && vendor/bin/phpunit --verbose --coverage-clover=coverage.xml
export CODECOVERAGE=1 && vendor/bin/phpunit --coverage-clover=coverage.xml
else
vendor/bin/phpunit
fi
Expand All @@ -73,7 +70,7 @@ jobs:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
/vendor/
/.idea/
/.phpunit.result.cache
./phpunit.xml.dist
/phpstan.neon
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# CakePHP Localized plugin

![Build Status](https://github.com/cakephp/localized/actions/workflows/ci.yml/badge.svg)
[![Coverage Status](https://img.shields.io/codecov/c/github/cakephp/localized/4.x.svg?style=flat-square)](https://app.codecov.io/gh/cakephp/localized/tree/4.x)
[![Latest Stable Version](https://img.shields.io/github/v/release/cakephp/localized?sort=semver&style=flat-square)](https://packagist.org/packages/cakephp/localized)
[![Total Downloads](https://img.shields.io/packagist/dt/cakephp/localized?style=flat-square)](https://packagist.org/packages/cakephp/localized/stats)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
Expand Down Expand Up @@ -45,7 +46,7 @@ class PostsTable extends Table
$validator->setProvider('fr', FrValidation::class);
$validator->add('phoneField', 'myCustomRuleNameForPhone', [
'rule' => 'phone',
'provider' => 'fr'
'provider' => 'fr',
]);
}
}
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
"@stan",
"@psalm"
],
"cs-check": "phpcs --colors --parallel=16 -p src/ tests/",
"cs-fix": "phpcbf --colors --parallel=16 -p src/ tests/",
"cs-check": "phpcs --colors --parallel=16 -p",
"cs-fix": "phpcbf --colors --parallel=16 -p",
"test": "phpunit --stderr",
"stan": "phpstan analyse src/",
"psalm": "php vendor/psalm/phar/psalm.phar --show-info=false src/",
Expand Down
3 changes: 3 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<ruleset name="localized">
<config name="installed_paths" value="../../cakephp/cakephp-codesniffer"/>

<file>src/</file>
<file>tests/</file>

<rule ref="CakePHP"/>

<rule ref="Generic.Files.LineLength">
Expand Down
11 changes: 7 additions & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="tests/bootstrap.php" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd">
<php>
<ini name="memory_limit" value="-1"/>
<ini name="apc.enable_cli" value="1"/>
</php>

<!-- Add any additional test suites you want to run here -->
<testsuites>
<testsuite name="Localized Test Suite">
<testsuite name="localized">
<directory>./tests/TestCase</directory>
</testsuite>
</testsuites>


<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
38 changes: 31 additions & 7 deletions resources/locales/vi/cake.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2015-11-05 12:39+0000\n"
"PO-Revision-Date: 2016-06-13 14:34+0700\n"
"Last-Translator: ANH TUAN NGUYEN <ANHTUANK7C@HOTMAIL.COM>\n"
"PO-Revision-Date: 2023-06-02 10:00-0700\n"
"Last-Translator: TOMMY DO <DHHUY0704@GMAIL.COM>\n"
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
Expand Down Expand Up @@ -83,7 +83,7 @@ msgstr "vừa xong"

#: I18n/Time.php:428
msgid "about a second ago"
msgstr "khoảng một giấy trước"
msgstr "khoảng một giây trước"

#: I18n/Time.php:429
msgid "about a minute ago"
Expand Down Expand Up @@ -173,11 +173,11 @@ msgstr[1] "{0} giây"

#: Network/Response.php:1438
msgid "The requested file was not found"
msgstr "Tệp tin yêu cầu không tồn tại"
msgstr "Tập tin yêu cầu không tồn tại"

#: ORM/RulesChecker.php:49
msgid "This value is already in use"
msgstr "Giá trị đã được sử dụng"
msgstr "Giá trị này đã được sử dụng"

#: ORM/RulesChecker.php:83
msgid "This value does not exist"
Expand All @@ -189,15 +189,15 @@ msgstr "và"

#: Validation/Validator.php:102
msgid "This field is required"
msgstr "Trường này cần nhập liệu"
msgstr "Trường này cần được điền vào"

#: Validation/Validator.php:103
msgid "This field cannot be left empty"
msgstr "Trường này không được để trống"

#: Validation/Validator.php:663
msgid "The provided value is invalid"
msgstr "Giá trị nhập vào không đúng"
msgstr "Giá trị nhập vào không hợp lệ"

#: View/Helper/FormHelper.php:925
msgid "New %s"
Expand Down Expand Up @@ -263,3 +263,27 @@ msgstr "Tháng Mười Một"
msgid "December"
msgstr "Tháng Mười Hai"

#: Http/Middleware/CsrfProtectionMiddleware.php:286
msgid "Missing or incorrect CSRF cookie type."
msgstr "Thiếu hoặc không đúng định dạng CSRF cookie."

#: Http/Middleware/CsrfProtectionMiddleware.php:290
msgid "Missing or invalid CSRF cookie."
msgstr "Thiếu hoặc CSRF cookie không hợp lệ."

#: Http/Middleware/CsrfProtectionMiddleware.php:311
msgid "CSRF token from either the request body or request headers did not match or is missing."
msgstr "Mã CSRF từ nội dung yêu cầu hoặc tiêu đề yêu cầu không khớp hoặc bị thiếu."

#: Http/Response.php:1490
msgid "The requested file contains `..` and will not be read."
msgstr "Trong tập tin yêu cầu có chứa `..` và nó không thể đọc được"

#: ORM/RulesChecker.php:224
msgid "Cannot modify row: a constraint for the `{0}` association fails."
msgstr "Không thể chỉnh sửa dòng: ràng buộc cho liên kết `{0}` không đúng."

#: ORM/RulesChecker.php:262
msgid "The count does not match {0}{1}"
msgstr "Số lượng không khớp với {0}{1}"

2 changes: 1 addition & 1 deletion src/Plugin.php → src/LocalizedPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

use Cake\Core\BasePlugin;

class Plugin extends BasePlugin
class LocalizedPlugin extends BasePlugin
{
/**
* Plugin name.
Expand Down
10 changes: 5 additions & 5 deletions tests/TestCase/Validation/FiValidationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class FiValidationTest extends TestCase
*
* @return array
*/
public function personIdProvider()
public static function personIdProvider()
{
return [
['120553-128K', true],
Expand All @@ -50,7 +50,7 @@ public function personIdProvider()
*
* @return array
*/
public function postalProvider()
public static function postalProvider()
{
return [
['00000', true],
Expand All @@ -64,7 +64,7 @@ public function postalProvider()
/**
* @return array
*/
public function businessIdProvider()
public static function businessIdProvider()
{
return [
['16067584', true],
Expand All @@ -77,7 +77,7 @@ public function businessIdProvider()
/**
* @return array
*/
public function creditorReferenceProvider()
public static function creditorReferenceProvider()
{
return [
['RF6110032', true],
Expand All @@ -90,7 +90,7 @@ public function creditorReferenceProvider()
/**
* @return array
*/
public function referenceNumberProvider()
public static function referenceNumberProvider()
{
return [
['00001234561', true],
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Validation/LvValidationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class LvValidationTest extends TestCase
*
* @return array
*/
public function personIdProvider()
public static function personIdProvider()
{
return [
['030972-10200', true],
Expand Down
7 changes: 5 additions & 2 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php
declare(strict_types=1);

use Cake\Core\Configure;
use Cake\Core\Plugin;
use Cake\Localized\LocalizedPlugin;

$findRoot = function ($root) {
do {
Expand All @@ -28,11 +30,12 @@
define('DS', DIRECTORY_SEPARATOR);
}

Cake\Core\Configure::write('debug', true);
Configure::write('debug', true);

require $root . '/vendor/cakephp/cakephp/tests/bootstrap.php';
require $root . '/vendor/cakephp/cakephp/src/functions.php';

Plugin::getCollection()->add(new Cake\Localized\Plugin([
Plugin::getCollection()->add(new LocalizedPlugin([
'path' => dirname(dirname(__FILE__)) . DS,
'routes' => false,
]));

0 comments on commit d9cc7d4

Please sign in to comment.