44
55namespace PhpLlm \LlmChain \Tests \Chain \ToolBox \Attribute ;
66
7- use PhpLlm \LlmChain \Chain \ToolBox \Attribute \ToolParameter ;
7+ use PhpLlm \LlmChain \Chain \ToolBox \Attribute \With ;
88use PHPUnit \Framework \Attributes \CoversClass ;
99use PHPUnit \Framework \Attributes \Test ;
1010use PHPUnit \Framework \TestCase ;
1111use Webmozart \Assert \InvalidArgumentException ;
1212
13- #[CoversClass(ToolParameter ::class)]
13+ #[CoversClass(With ::class)]
1414final class ToolParameterTest extends TestCase
1515{
1616 #[Test]
1717 public function validEnum (): void
1818 {
1919 $ enum = ['value1 ' , 'value2 ' ];
20- $ toolParameter = new ToolParameter (enum: $ enum );
20+ $ toolParameter = new With (enum: $ enum );
2121 self ::assertSame ($ enum , $ toolParameter ->enum );
2222 }
2323
@@ -26,14 +26,14 @@ public function invalidEnumContainsNonString(): void
2626 {
2727 $ this ->expectException (InvalidArgumentException::class);
2828 $ enum = ['value1 ' , 2 ];
29- new ToolParameter (enum: $ enum );
29+ new With (enum: $ enum );
3030 }
3131
3232 #[Test]
3333 public function validConstString (): void
3434 {
3535 $ const = 'constant value ' ;
36- $ toolParameter = new ToolParameter (const: $ const );
36+ $ toolParameter = new With (const: $ const );
3737 self ::assertSame ($ const , $ toolParameter ->const );
3838 }
3939
@@ -42,14 +42,14 @@ public function invalidConstEmptyString(): void
4242 {
4343 $ this ->expectException (InvalidArgumentException::class);
4444 $ const = ' ' ;
45- new ToolParameter (const: $ const );
45+ new With (const: $ const );
4646 }
4747
4848 #[Test]
4949 public function validPattern (): void
5050 {
5151 $ pattern = '/^[a-z]+$/ ' ;
52- $ toolParameter = new ToolParameter (pattern: $ pattern );
52+ $ toolParameter = new With (pattern: $ pattern );
5353 self ::assertSame ($ pattern , $ toolParameter ->pattern );
5454 }
5555
@@ -58,30 +58,30 @@ public function invalidPatternEmptyString(): void
5858 {
5959 $ this ->expectException (InvalidArgumentException::class);
6060 $ pattern = ' ' ;
61- new ToolParameter (pattern: $ pattern );
61+ new With (pattern: $ pattern );
6262 }
6363
6464 #[Test]
6565 public function validMinLength (): void
6666 {
6767 $ minLength = 5 ;
68- $ toolParameter = new ToolParameter (minLength: $ minLength );
68+ $ toolParameter = new With (minLength: $ minLength );
6969 self ::assertSame ($ minLength , $ toolParameter ->minLength );
7070 }
7171
7272 #[Test]
7373 public function invalidMinLengthNegative (): void
7474 {
7575 $ this ->expectException (InvalidArgumentException::class);
76- new ToolParameter (minLength: -1 );
76+ new With (minLength: -1 );
7777 }
7878
7979 #[Test]
8080 public function validMinLengthAndMaxLength (): void
8181 {
8282 $ minLength = 5 ;
8383 $ maxLength = 10 ;
84- $ toolParameter = new ToolParameter (minLength: $ minLength , maxLength: $ maxLength );
84+ $ toolParameter = new With (minLength: $ minLength , maxLength: $ maxLength );
8585 self ::assertSame ($ minLength , $ toolParameter ->minLength );
8686 self ::assertSame ($ maxLength , $ toolParameter ->maxLength );
8787 }
@@ -90,45 +90,45 @@ public function validMinLengthAndMaxLength(): void
9090 public function invalidMaxLengthLessThanMinLength (): void
9191 {
9292 $ this ->expectException (InvalidArgumentException::class);
93- new ToolParameter (minLength: 10 , maxLength: 5 );
93+ new With (minLength: 10 , maxLength: 5 );
9494 }
9595
9696 #[Test]
9797 public function validMinimum (): void
9898 {
9999 $ minimum = 0 ;
100- $ toolParameter = new ToolParameter (minimum: $ minimum );
100+ $ toolParameter = new With (minimum: $ minimum );
101101 self ::assertSame ($ minimum , $ toolParameter ->minimum );
102102 }
103103
104104 #[Test]
105105 public function invalidMinimumNegative (): void
106106 {
107107 $ this ->expectException (InvalidArgumentException::class);
108- new ToolParameter (minimum: -1 );
108+ new With (minimum: -1 );
109109 }
110110
111111 #[Test]
112112 public function validMultipleOf (): void
113113 {
114114 $ multipleOf = 5 ;
115- $ toolParameter = new ToolParameter (multipleOf: $ multipleOf );
115+ $ toolParameter = new With (multipleOf: $ multipleOf );
116116 self ::assertSame ($ multipleOf , $ toolParameter ->multipleOf );
117117 }
118118
119119 #[Test]
120120 public function invalidMultipleOfNegative (): void
121121 {
122122 $ this ->expectException (InvalidArgumentException::class);
123- new ToolParameter (multipleOf: -5 );
123+ new With (multipleOf: -5 );
124124 }
125125
126126 #[Test]
127127 public function validExclusiveMinimumAndMaximum (): void
128128 {
129129 $ exclusiveMinimum = 1 ;
130130 $ exclusiveMaximum = 10 ;
131- $ toolParameter = new ToolParameter (exclusiveMinimum: $ exclusiveMinimum , exclusiveMaximum: $ exclusiveMaximum );
131+ $ toolParameter = new With (exclusiveMinimum: $ exclusiveMinimum , exclusiveMaximum: $ exclusiveMaximum );
132132 self ::assertSame ($ exclusiveMinimum , $ toolParameter ->exclusiveMinimum );
133133 self ::assertSame ($ exclusiveMaximum , $ toolParameter ->exclusiveMaximum );
134134 }
@@ -137,15 +137,15 @@ public function validExclusiveMinimumAndMaximum(): void
137137 public function invalidExclusiveMaximumLessThanExclusiveMinimum (): void
138138 {
139139 $ this ->expectException (InvalidArgumentException::class);
140- new ToolParameter (exclusiveMinimum: 10 , exclusiveMaximum: 5 );
140+ new With (exclusiveMinimum: 10 , exclusiveMaximum: 5 );
141141 }
142142
143143 #[Test]
144144 public function validMinItemsAndMaxItems (): void
145145 {
146146 $ minItems = 1 ;
147147 $ maxItems = 5 ;
148- $ toolParameter = new ToolParameter (minItems: $ minItems , maxItems: $ maxItems );
148+ $ toolParameter = new With (minItems: $ minItems , maxItems: $ maxItems );
149149 self ::assertSame ($ minItems , $ toolParameter ->minItems );
150150 self ::assertSame ($ maxItems , $ toolParameter ->maxItems );
151151 }
@@ -154,29 +154,29 @@ public function validMinItemsAndMaxItems(): void
154154 public function invalidMaxItemsLessThanMinItems (): void
155155 {
156156 $ this ->expectException (InvalidArgumentException::class);
157- new ToolParameter (minItems: 5 , maxItems: 1 );
157+ new With (minItems: 5 , maxItems: 1 );
158158 }
159159
160160 #[Test]
161161 public function validUniqueItemsTrue (): void
162162 {
163- $ toolParameter = new ToolParameter (uniqueItems: true );
163+ $ toolParameter = new With (uniqueItems: true );
164164 self ::assertTrue ($ toolParameter ->uniqueItems );
165165 }
166166
167167 #[Test]
168168 public function invalidUniqueItemsFalse (): void
169169 {
170170 $ this ->expectException (InvalidArgumentException::class);
171- new ToolParameter (uniqueItems: false );
171+ new With (uniqueItems: false );
172172 }
173173
174174 #[Test]
175175 public function validMinContainsAndMaxContains (): void
176176 {
177177 $ minContains = 1 ;
178178 $ maxContains = 3 ;
179- $ toolParameter = new ToolParameter (minContains: $ minContains , maxContains: $ maxContains );
179+ $ toolParameter = new With (minContains: $ minContains , maxContains: $ maxContains );
180180 self ::assertSame ($ minContains , $ toolParameter ->minContains );
181181 self ::assertSame ($ maxContains , $ toolParameter ->maxContains );
182182 }
@@ -185,13 +185,13 @@ public function validMinContainsAndMaxContains(): void
185185 public function invalidMaxContainsLessThanMinContains (): void
186186 {
187187 $ this ->expectException (InvalidArgumentException::class);
188- new ToolParameter (minContains: 3 , maxContains: 1 );
188+ new With (minContains: 3 , maxContains: 1 );
189189 }
190190
191191 #[Test]
192192 public function validRequired (): void
193193 {
194- $ toolParameter = new ToolParameter (required: true );
194+ $ toolParameter = new With (required: true );
195195 self ::assertTrue ($ toolParameter ->required );
196196 }
197197
@@ -200,7 +200,7 @@ public function validMinPropertiesAndMaxProperties(): void
200200 {
201201 $ minProperties = 1 ;
202202 $ maxProperties = 5 ;
203- $ toolParameter = new ToolParameter (minProperties: $ minProperties , maxProperties: $ maxProperties );
203+ $ toolParameter = new With (minProperties: $ minProperties , maxProperties: $ maxProperties );
204204 self ::assertSame ($ minProperties , $ toolParameter ->minProperties );
205205 self ::assertSame ($ maxProperties , $ toolParameter ->maxProperties );
206206 }
@@ -209,20 +209,20 @@ public function validMinPropertiesAndMaxProperties(): void
209209 public function invalidMaxPropertiesLessThanMinProperties (): void
210210 {
211211 $ this ->expectException (InvalidArgumentException::class);
212- new ToolParameter (minProperties: 5 , maxProperties: 1 );
212+ new With (minProperties: 5 , maxProperties: 1 );
213213 }
214214
215215 #[Test]
216216 public function validDependentRequired (): void
217217 {
218- $ toolParameter = new ToolParameter (dependentRequired: true );
218+ $ toolParameter = new With (dependentRequired: true );
219219 self ::assertTrue ($ toolParameter ->dependentRequired );
220220 }
221221
222222 #[Test]
223223 public function validCombination (): void
224224 {
225- $ toolParameter = new ToolParameter (
225+ $ toolParameter = new With (
226226 enum: ['value1 ' , 'value2 ' ],
227227 const: 'constant ' ,
228228 pattern: '/^[a-z]+$/ ' ,
@@ -244,13 +244,13 @@ enum: ['value1', 'value2'],
244244 dependentRequired: true
245245 );
246246
247- self ::assertInstanceOf (ToolParameter ::class, $ toolParameter );
247+ self ::assertInstanceOf (With ::class, $ toolParameter );
248248 }
249249
250250 #[Test]
251251 public function invalidCombination (): void
252252 {
253253 $ this ->expectException (InvalidArgumentException::class);
254- new ToolParameter (minLength: -1 , maxLength: -2 );
254+ new With (minLength: -1 , maxLength: -2 );
255255 }
256256}
0 commit comments