Skip to content

Commit 003cd72

Browse files
committed
Added tests for computed attribute
1 parent b5a5019 commit 003cd72

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

.github/workflows/php-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PHP Composer CI Tests
1+
name: CI Tests
22

33
on:
44
push:

.github/workflows/phpstan-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PHP Composer PHPStan Tests
1+
name: PHPStan Checks
22

33
on:
44
push:

tests/Unit/Concerns/BaseDataTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Nuxtifyts\PhpDto\Exceptions\DeserializeException;
88
use Nuxtifyts\PhpDto\Exceptions\SerializeException;
99
use Nuxtifyts\PhpDto\Tests\Dummies\AddressData;
10+
use Nuxtifyts\PhpDto\Tests\Dummies\ComputedPropertiesData;
1011
use Nuxtifyts\PhpDto\Tests\Dummies\CoordinatesData;
1112
use Nuxtifyts\PhpDto\Tests\Dummies\CountryData;
1213
use Nuxtifyts\PhpDto\Tests\Dummies\Enums\YesNoBackedEnum;
@@ -42,6 +43,7 @@
4243
#[UsesClass(UnionMultipleComplexData::class)]
4344
#[UsesClass(UserLocationData::class)]
4445
#[UsesClass(UserGroupData::class)]
46+
#[UsesClass(ComputedPropertiesData::class)]
4547
final class BaseDataTest extends UnitCase
4648
{
4749
/**
@@ -464,6 +466,19 @@ public static function will_perform_serialization_and_deserialization_data_provi
464466
'users' => [1, 2]
465467
],
466468
'expectedSerializedData' => $data
469+
],
470+
'Computed properties data' => [
471+
'dtoClass' => ComputedPropertiesData::class,
472+
'data' => $data = [
473+
'a' => 'a',
474+
'b' => 'b'
475+
],
476+
'expectedProperties' => [
477+
'a' => 'a',
478+
'b' => 'b',
479+
'c' => 'ab'
480+
],
481+
'expectedSerializedData' => $data
467482
]
468483
];
469484
}

0 commit comments

Comments
 (0)