Skip to content

Commit c0cb5b5

Browse files
committed
- Remove deprecated AIPROMT.md file and migrate content to .junie/guidelines.md for better organization.
- Add unit tests to enhance validation for `DateTimeBasic` with trailing data scenarios.
1 parent 39b776e commit c0cb5b5

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

AIPROMT.md renamed to .junie/guidelines.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
- keep code clean and readable
1919
- PSALM v6 static analysis is used
2020

21-
## Folder structure
21+
## Folder structure
2222

2323
- `src/Code` folder contains the framework internal code
24-
- other folders like `src/"type"` contains specific types
24+
- other folders like `src/"type"` contains specific types
2525
- `src/psalmTest.php` contains types usage to avoid Psalm issues like `unused method`
26-
- `src/Code/Assert/Assert.php` contains `assert` methods, add new methods instead of checking conditions directly in classes. Prefer to use Assert::"methos()".
26+
- `src/Code/Assert/Assert.php` contains `assert` methods, add new methods instead of checking conditions directly in classes. Prefer to use Assert::"methos()".
2727

2828
## Tests
2929

@@ -32,7 +32,7 @@
3232
- use PEST syntax `it` instead of `test`
3333
- keep the folder structure as tested src files
3434
- test coverage should be 100%
35-
- mutation tests used, avoid fails
35+
- mutation tests used, avoid fails
3636

3737
## Documentation
3838

tests/Unit/Code/DateTime/DateTimeTypeTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@
6767
->toThrow(DateTimeTypeException::class);
6868
});
6969

70+
it('rejects DATE_ATOM with trailing data (warnings from createFromFormat)', function (): void {
71+
// Matches DATE_ATOM except for trailing junk which should produce warnings; must be rejected
72+
expect(fn() => DateTimeBasic::fromString('2025-01-02T03:04:05+00:00junk'))
73+
->toThrow(DateTimeTypeException::class);
74+
});
75+
76+
it('rejects Z-format with trailing data (warnings from createFromFormat)', function (): void {
77+
// Matches explicit Z format with extra trailing characters; must be rejected
78+
expect(fn() => DateTimeBasic::fromString('2025-01-02T03:04:05Zjunk'))
79+
->toThrow(DateTimeTypeException::class);
80+
});
81+
7082
it('normalizes Zulu input to +00:00 via toString()', function (): void {
7183
// Parsed by the explicit 'Y-m-d\\TH:i:s\\Z' format, toString should output DATE_ATOM with +00:00
7284
$vo = DateTimeBasic::fromString('2025-01-02T03:04:05Z');

0 commit comments

Comments
 (0)