@@ -15,9 +15,9 @@ class APIModelsFreeRADIUSClientTestCase extends TestCase {
1515 # Create a new FreeRADIUSClient
1616 $ client = new FreeRADIUSClient (
1717 addr: '1.2.3.4 ' ,
18- ip_version: " ipaddr " ,
19- shortname: " testclient " ,
20- secret: " testsecret " ,
18+ ip_version: ' ipaddr ' ,
19+ shortname: ' testclient ' ,
20+ secret: ' testsecret ' ,
2121 proto: 'udp ' ,
2222 nastype: 'dot1x ' ,
2323 msgauth: false ,
@@ -30,34 +30,33 @@ class APIModelsFreeRADIUSClientTestCase extends TestCase {
3030 $ raddb = file_get_contents ('/usr/local/etc/raddb/clients.conf ' );
3131 $ this ->assert_str_contains ($ raddb , 'client "testclient" { ' );
3232 $ this ->assert_str_contains ($ raddb , 'ipaddr = 1.2.3.4 ' );
33- $ this ->assert_str_contains ($ raddb , " proto = udp " );
34- $ this ->assert_str_contains ($ raddb , " nas_type = dot1x " );
35- $ this ->assert_str_contains ($ raddb , " login = testlogin " );
36- $ this ->assert_str_contains ($ raddb , " password = testpassword " );
37- $ this ->assert_str_contains ($ raddb , " require_message_authenticator = no " );
33+ $ this ->assert_str_contains ($ raddb , ' proto = udp ' );
34+ $ this ->assert_str_contains ($ raddb , ' nas_type = dot1x ' );
35+ $ this ->assert_str_contains ($ raddb , ' login = testlogin ' );
36+ $ this ->assert_str_contains ($ raddb , ' password = testpassword ' );
37+ $ this ->assert_str_contains ($ raddb , ' require_message_authenticator = no ' );
3838 $ this ->assert_str_contains ($ raddb , 'max_connections = 16 ' );
3939
40-
4140 # Ensure we can read the created user from the config
4241 $ read_client = new FreeRADIUSClient (id: $ client ->id );
43- $ this ->assert_equals ($ read_client ->addr ->value , " 1.2.3.4 " );
44- $ this ->assert_equals ($ read_client ->ip_version ->value , " ipaddr " );
45- $ this ->assert_equals ($ read_client ->shortname ->value , " testclient " );
46- $ this ->assert_str_contains ($ read_client ->proto ->value , " udp " );
47- $ this ->assert_str_contains ($ read_client ->nastype ->value , " dot1x " );
42+ $ this ->assert_equals ($ read_client ->addr ->value , ' 1.2.3.4 ' );
43+ $ this ->assert_equals ($ read_client ->ip_version ->value , ' ipaddr ' );
44+ $ this ->assert_equals ($ read_client ->shortname ->value , ' testclient ' );
45+ $ this ->assert_str_contains ($ read_client ->proto ->value , ' udp ' );
46+ $ this ->assert_str_contains ($ read_client ->nastype ->value , ' dot1x ' );
4847 $ this ->assert_equals ($ read_client ->msgauth ->value , false );
4948 $ this ->assert_equals ($ read_client ->maxconn ->value , 16 );
50- $ this ->assert_equals ($ read_client ->naslogin ->value , " testlogin " );
51- $ this ->assert_equals ($ read_client ->naspassword ->value , " testpassword " );
52- $ this ->assert_equals ($ read_client ->description ->value , " Test client " );
49+ $ this ->assert_equals ($ read_client ->naslogin ->value , ' testlogin ' );
50+ $ this ->assert_equals ($ read_client ->naspassword ->value , ' testpassword ' );
51+ $ this ->assert_equals ($ read_client ->description ->value , ' Test client ' );
5352
5453 # Ensure we can update the user
5554 $ client = new FreeRADIUSClient (
5655 id: $ read_client ->id ,
5756 addr: '4321::1 ' ,
58- ip_version: " ipv6addr " ,
59- shortname: " newtestclient " ,
60- secret: " newtestsecret " ,
57+ ip_version: ' ipv6addr ' ,
58+ shortname: ' newtestclient ' ,
59+ secret: ' newtestsecret ' ,
6160 proto: 'tcp ' ,
6261 nastype: 'cisco ' ,
6362 msgauth: true ,
@@ -71,11 +70,11 @@ class APIModelsFreeRADIUSClientTestCase extends TestCase {
7170 $ this ->assert_str_does_not_contain ($ raddb , 'client "testclient" { ' );
7271 $ this ->assert_str_contains ($ raddb , 'client "newtestclient" { ' );
7372 $ this ->assert_str_contains ($ raddb , 'ipaddr = 4321::1 ' );
74- $ this ->assert_str_contains ($ raddb , " proto = tcp " );
75- $ this ->assert_str_contains ($ raddb , " nas_type = cisco " );
76- $ this ->assert_str_contains ($ raddb , " login = newtestlogin " );
77- $ this ->assert_str_contains ($ raddb , " password = newtestpassword " );
78- $ this ->assert_str_contains ($ raddb , " require_message_authenticator = yes " );
73+ $ this ->assert_str_contains ($ raddb , ' proto = tcp ' );
74+ $ this ->assert_str_contains ($ raddb , ' nas_type = cisco ' );
75+ $ this ->assert_str_contains ($ raddb , ' login = newtestlogin ' );
76+ $ this ->assert_str_contains ($ raddb , ' password = newtestpassword ' );
77+ $ this ->assert_str_contains ($ raddb , ' require_message_authenticator = yes ' );
7978 $ this ->assert_str_contains ($ raddb , 'max_connections = 32 ' );
8079
8180 # Delete the user and ensure it is removed from the database
@@ -90,30 +89,30 @@ class APIModelsFreeRADIUSClientTestCase extends TestCase {
9089 */
9190 public function test_ip_version_mismatch (): void {
9291 $ this ->assert_throws_response (
93- response_id: " FREERADIUS_CLIENT_ADDR_IPV4_NOT_ALLOWED " ,
92+ response_id: ' FREERADIUS_CLIENT_ADDR_IPV4_NOT_ALLOWED ' ,
9493 code: 400 ,
9594 callable: function () {
96- $ client = new FreeRADIUSClient (ip_version: " ipv6addr " );
97- $ client ->validate_addr (" 1.2.3.4 " );
98- }
95+ $ client = new FreeRADIUSClient (ip_version: ' ipv6addr ' );
96+ $ client ->validate_addr (' 1.2.3.4 ' );
97+ },
9998 );
10099 $ this ->assert_throws_response (
101- response_id: " FREERADIUS_CLIENT_ADDR_IPV6_NOT_ALLOWED " ,
100+ response_id: ' FREERADIUS_CLIENT_ADDR_IPV6_NOT_ALLOWED ' ,
102101 code: 400 ,
103102 callable: function () {
104- $ client = new FreeRADIUSClient (ip_version: " ipaddr " );
105- $ client ->validate_addr (" 1234::1 " );
106- }
103+ $ client = new FreeRADIUSClient (ip_version: ' ipaddr ' );
104+ $ client ->validate_addr (' 1234::1 ' );
105+ },
107106 );
108107
109108 # Ensure * is always allowed
110109 $ this ->assert_does_not_throw (
111110 callable: function () {
112- $ client = new FreeRADIUSClient (ip_version: " ipaddr " );
113- $ client ->validate_addr (" * " );
114- $ client = new FreeRADIUSClient (ip_version: " ipv6addr " );
115- $ client ->validate_addr (" * " );
116- }
111+ $ client = new FreeRADIUSClient (ip_version: ' ipaddr ' );
112+ $ client ->validate_addr (' * ' );
113+ $ client = new FreeRADIUSClient (ip_version: ' ipv6addr ' );
114+ $ client ->validate_addr (' * ' );
115+ },
117116 );
118117 }
119118}
0 commit comments