@@ -112,32 +112,11 @@ public function testDisplay(): void
112112
113113 public function testStringToClass (): void
114114 {
115- // namespace
116- $ this ->assertSame ('LibreNMS\OS\Os ' , StringHelpers::toClass ('os ' , 'LibreNMS \\OS \\' ));
115+ $ this ->assertSame ('LibreNMS\OS\Os ' , StringHelpers::toClass ('OS ' , 'LibreNMS \\OS \\' ));
116+ $ this ->assertSame ('SpacesName ' , StringHelpers::toClass ('spaces name ' , null ));
117+ $ this ->assertSame ('DashName ' , StringHelpers::toClass ('dash-name ' , null ));
118+ $ this ->assertSame ('UnderscoreName ' , StringHelpers::toClass ('underscore_name ' , null ));
117119 $ this ->assertSame ('LibreNMS \\AllOfThemName ' , StringHelpers::toClass ('all OF-thEm_NaMe ' , 'LibreNMS \\' ));
118- $ this ->assertSame ('App \\Models \\FooBar ' , StringHelpers::toClass ('foo_bar ' , 'App \\Models \\' ));
119-
120- // delimiters
121- $ this ->assertSame ('SpacesName ' , StringHelpers::toClass ('spaces name ' ));
122- $ this ->assertSame ('DashName ' , StringHelpers::toClass ('dash-name ' ));
123- $ this ->assertSame ('UnderscoreName ' , StringHelpers::toClass ('underscore_name ' ));
124- $ this ->assertSame ('FooBarBaz ' , StringHelpers::toClass ('foo-bar_baz ' ));
125-
126- // camel/pascal input
127- $ this ->assertSame ('FooBar ' , StringHelpers::toClass ('fooBar ' ));
128- $ this ->assertSame ('FooBar ' , StringHelpers::toClass ('FooBar ' ));
129- $ this ->assertSame ('MyHTTPRequest ' , StringHelpers::toClass ('myHTTPRequest ' ));
130-
131- // numeric prefix
132- $ this ->assertSame ('ZeroClass ' , StringHelpers::toClass ('0_class ' ));
133- $ this ->assertSame ('ZeroName ' , StringHelpers::toClass ('0name ' ));
134- $ this ->assertSame ('OneClass ' , StringHelpers::toClass ('1_class ' ));
135- $ this ->assertSame ('NineClass ' , StringHelpers::toClass ('9_class ' ));
136- $ this ->assertSame ('Foo2Bar ' , StringHelpers::toClass ('foo_2_bar ' ));
137-
138- // single word / edge cases
139- $ this ->assertSame ('Foo ' , StringHelpers::toClass ('foo ' ));
140- $ this ->assertSame ('FOOBAR ' , StringHelpers::toClass ('FOOBAR ' ));
141120 }
142121
143122 public function testIsValidHostname (): void
0 commit comments