Skip to content

Commit fa45cc2

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

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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\BannedIP;
18+
use Models\WhiteListedIP;
19+
use Tests\BrowserKitTestCase;
20+
21+
/**
22+
* Class WhiteListedIPMappingTest
23+
* @package Tests\unit
24+
*/
25+
class WhiteListedIPMappingTest extends BrowserKitTestCase
26+
{
27+
public function testWhiteListedIPPersistence()
28+
{
29+
$ip = "127.0.0.1";
30+
$wl_ip = new WhiteListedIP();
31+
$wl_ip->setIp("127.0.0.1");
32+
33+
EntityManager::persist($wl_ip);
34+
EntityManager::flush();
35+
EntityManager::clear();
36+
37+
$repo = EntityManager::getRepository(WhiteListedIP::class);
38+
$found_wl_ip = $repo->find($wl_ip->getId());
39+
40+
$this->assertInstanceOf(WhiteListedIP::class, $found_wl_ip);
41+
$this->assertEquals($ip, $found_wl_ip->getIp());
42+
}
43+
}

0 commit comments

Comments
 (0)