Skip to content

Commit 87e3781

Browse files
committed
Merge branch 'php-last' into development
2 parents d0d5271 + 1698fee commit 87e3781

File tree

5 files changed

+58
-7
lines changed

5 files changed

+58
-7
lines changed

.github/workflows/tests.yml

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ jobs:
1313

1414
strategy:
1515
fail-fast: true
16-
matrix:
17-
php: ['8.1']
1816

19-
name: PHP ${{ matrix.php }}
17+
name: PHP 8.1
2018

2119
steps:
2220
- name: Checkout
@@ -25,7 +23,7 @@ jobs:
2523
- name: Setup PHP
2624
uses: shivammathur/setup-php@v2
2725
with:
28-
php-version: ${{ matrix.php }}
26+
php-version: 8.1
2927
tools: composer
3028
coverage: xdebug
3129

@@ -60,4 +58,30 @@ jobs:
6058
cp build/coverage/clover.xml build/logs/clover.xml
6159
composer global require php-coveralls/php-coveralls
6260
php-coveralls --coverage_clover=build/logs/clover.xml -v
63-
if: matrix.php == '8.1'
61+
62+
tests-last:
63+
runs-on: ubuntu-20.04
64+
timeout-minutes: 10
65+
66+
strategy:
67+
fail-fast: true
68+
69+
name: PHP 8.2 - Last
70+
71+
steps:
72+
- name: Checkout
73+
uses: actions/checkout@v2
74+
75+
- name: Setup PHP
76+
uses: shivammathur/setup-php@v2
77+
with:
78+
php-version: 8.2
79+
tools: composer
80+
coverage: xdebug
81+
82+
- name: Install dependencies
83+
run:
84+
composer update
85+
86+
- name: PHPUnit
87+
run: vendor/bin/phpunit --verbose

.gitlab-ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ test:php:
1515
- build/
1616
- vendor/
1717
before_script:
18+
- php -v
1819
- composer update
1920
script:
2021
- composer normalize --dry-run --indent-size=4 --indent-style=space
@@ -29,6 +30,20 @@ test:php:
2930
- build/docs/
3031
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
3132

33+
test:php-last:
34+
image: registry.gitlab.com/aplus-framework/images/base:3
35+
stage: test
36+
timeout: 10 minutes
37+
cache:
38+
paths:
39+
- vendor/
40+
before_script:
41+
- php -v
42+
- composer update
43+
script:
44+
- vendor/bin/phpunit --colors=never
45+
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
46+
3247
pages:
3348
stage: deploy
3449
timeout: 10 minutes

docker-compose.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,10 @@ services:
77
volumes:
88
- .:/package
99
tty: true
10+
package-last:
11+
image: registry.gitlab.com/aplus-framework/images/package:3
12+
container_name: package-validation-last
13+
working_dir: /package
14+
volumes:
15+
- .:/package
16+
tty: true

src/Validator.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,10 @@ public static function datetime(
408408
return false;
409409
}
410410
$lastErrors = \DateTime::getLastErrors();
411-
return $lastErrors
412-
&& $lastErrors['warning_count'] === 0
411+
if ($lastErrors === false) {
412+
return true;
413+
}
414+
return $lastErrors['warning_count'] === 0
413415
&& $lastErrors['error_count'] === 0;
414416
}
415417

tests/ValidatorTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ public function testDatetime() : void
182182
self::assertTrue(Validator::datetime('year', $this->array, 'Y'));
183183
self::assertFalse(Validator::datetime('alpha', $this->array));
184184
self::assertFalse(Validator::datetime('unknown', $this->array));
185+
self::assertFalse(Validator::datetime('foo', [
186+
'foo' => '2022-02-29 25:10:10',
187+
]));
185188
}
186189

187190
public function testEquals() : void

0 commit comments

Comments
 (0)