Skip to content

Commit

Permalink
Add tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
david_smith committed Oct 21, 2024
1 parent f858b6e commit 4fdf7c6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/Unit/Examples/From/ClassTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Tests\Unit\Examples\From;

use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

class ClassTest extends TestCase
{
#[Test] public function from(): void
{
$User = User::from([
'firstName' => '1',
]);

$this->assertEquals('1', $User->first_name);
}
}
15 changes: 15 additions & 0 deletions tests/Unit/Examples/From/User.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Tests\Unit\Examples\From;

use Zerotoprod\DataModel\Describe;

class User
{
use \Zerotoprod\DataModel\DataModel;

public const first_name = 'first_name';

#[Describe(['from' => 'firstName'])]
public string $first_name;
}

0 comments on commit 4fdf7c6

Please sign in to comment.