|
| 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\ServerConfiguration; |
| 18 | +use Tests\BrowserKitTestCase; |
| 19 | + |
| 20 | +/** |
| 21 | + * Class ServerConfigurationMappingTest |
| 22 | + * @package Tests\unit |
| 23 | + */ |
| 24 | +class ServerConfigurationMappingTest extends BrowserKitTestCase |
| 25 | +{ |
| 26 | + public function testServerConfigurationPersistence() |
| 27 | + { |
| 28 | + $key = 'test_key'; |
| 29 | + $value = 'test_value'; |
| 30 | + |
| 31 | + $conf = new ServerConfiguration(); |
| 32 | + $conf->setKey($key); |
| 33 | + $conf->setValue($value); |
| 34 | + EntityManager::persist($conf); |
| 35 | + EntityManager::flush(); |
| 36 | + EntityManager::clear(); |
| 37 | + |
| 38 | + $repo = EntityManager::getRepository(ServerConfiguration::class); |
| 39 | + $found_conf = $repo->find($conf->getId()); |
| 40 | + |
| 41 | + $this->assertInstanceOf(ServerConfiguration::class, $found_conf); |
| 42 | + $this->assertEquals($key, $found_conf->getKey()); |
| 43 | + $this->assertEquals($value, $found_conf->getValue()); |
| 44 | + } |
| 45 | +} |
0 commit comments