Skip to content

Commit 30527b2

Browse files
committed
feat: attributed orm mapping - ServerExtension mapping unit test
Signed-off-by: romanetar <roman_ag@hotmail.com>
1 parent fa45cc2 commit 30527b2

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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 LaravelDoctrine\ORM\Facades\EntityManager;
17+
use Models\OpenId\ServerExtension;
18+
use Tests\BrowserKitTestCase;
19+
20+
/**
21+
* Class ServerExtensionMappingTest
22+
* @package Tests\unit
23+
*/
24+
class ServerExtensionMappingTest extends BrowserKitTestCase
25+
{
26+
public function testServerExtensionPersistence()
27+
{
28+
$name = "TestExt";
29+
30+
$ext = new ServerExtension();
31+
$ext->setName($name);
32+
$ext->setNamespace("TestExtNS");;
33+
$ext->setActive(true);
34+
$ext->setExtensionClass("TestExtClass");
35+
$ext->setDescription("Test description");
36+
$ext->setViewName("TestExtVN");
37+
38+
EntityManager::persist($ext);
39+
EntityManager::flush();
40+
EntityManager::clear();
41+
42+
$repo = EntityManager::getRepository(ServerExtension::class);
43+
$found_ext = $repo->find($ext->getId());
44+
45+
$this->assertInstanceOf(ServerExtension::class, $found_ext);
46+
$this->assertEquals($name, $found_ext->getName());
47+
}
48+
}

0 commit comments

Comments
 (0)