Skip to content

Commit e5b7ba9

Browse files
committed
feat: attributed orm mapping - UserRegistrationRequest mapping unit test
Signed-off-by: romanetar <roman_ag@hotmail.com>
1 parent 1a02805 commit e5b7ba9

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php namespace Tests\unit;
2+
3+
/**
4+
* Copyright 2025 OpenStack Foundation
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
**/
15+
16+
use App\libs\Auth\Models\UserRegistrationRequest;
17+
use Auth\UserPasswordResetRequest;
18+
use LaravelDoctrine\ORM\Facades\EntityManager;
19+
use Tests\BrowserKitTestCase;
20+
use Auth\User;
21+
22+
/**
23+
* Class UserRegistrationRequestMappingTest
24+
* @package Tests\unit
25+
*/
26+
class UserRegistrationRequestMappingTest extends BrowserKitTestCase
27+
{
28+
public function testUserRegistrationRequestPersistence()
29+
{
30+
$email = 'test@nomail.com';
31+
$f_name = 'First Name';
32+
$l_name = 'Last Name';
33+
$hash = 'TEST_HASH';
34+
35+
$req = new UserRegistrationRequest();
36+
$req->setEmail($email);
37+
$req->setFirstName($f_name);
38+
$req->setLastName($l_name);;
39+
$req->setCompany("Company");
40+
$req->setCountryIsoCode("US");
41+
$req->setHash($hash);
42+
43+
EntityManager::persist($req);
44+
EntityManager::flush();
45+
EntityManager::clear();
46+
47+
$repo = EntityManager::getRepository(UserRegistrationRequest::class);
48+
$found_req = $repo->find($req->getId());
49+
50+
$this->assertInstanceOf(UserRegistrationRequest::class, $found_req);
51+
$this->assertEquals($email, $found_req->getEmail());
52+
$this->assertEquals($f_name, $found_req->getFirstName());
53+
$this->assertEquals($l_name, $found_req->getLastName());
54+
$this->assertEquals($hash, $found_req->getHash());
55+
}
56+
}

0 commit comments

Comments
 (0)