4
4
5
5
namespace PhpLlm \LlmChain \Tests \Chain \ToolBox \Attribute ;
6
6
7
- use PhpLlm \LlmChain \Chain \ToolBox \Attribute \ToolParameter ;
7
+ use PhpLlm \LlmChain \Chain \ToolBox \Attribute \With ;
8
8
use PHPUnit \Framework \Attributes \CoversClass ;
9
9
use PHPUnit \Framework \Attributes \Test ;
10
10
use PHPUnit \Framework \TestCase ;
11
11
use Webmozart \Assert \InvalidArgumentException ;
12
12
13
- #[CoversClass(ToolParameter ::class)]
13
+ #[CoversClass(With ::class)]
14
14
final class ToolParameterTest extends TestCase
15
15
{
16
16
#[Test]
17
17
public function validEnum (): void
18
18
{
19
19
$ enum = ['value1 ' , 'value2 ' ];
20
- $ toolParameter = new ToolParameter (enum: $ enum );
20
+ $ toolParameter = new With (enum: $ enum );
21
21
self ::assertSame ($ enum , $ toolParameter ->enum );
22
22
}
23
23
@@ -26,14 +26,14 @@ public function invalidEnumContainsNonString(): void
26
26
{
27
27
$ this ->expectException (InvalidArgumentException::class);
28
28
$ enum = ['value1 ' , 2 ];
29
- new ToolParameter (enum: $ enum );
29
+ new With (enum: $ enum );
30
30
}
31
31
32
32
#[Test]
33
33
public function validConstString (): void
34
34
{
35
35
$ const = 'constant value ' ;
36
- $ toolParameter = new ToolParameter (const: $ const );
36
+ $ toolParameter = new With (const: $ const );
37
37
self ::assertSame ($ const , $ toolParameter ->const );
38
38
}
39
39
@@ -42,14 +42,14 @@ public function invalidConstEmptyString(): void
42
42
{
43
43
$ this ->expectException (InvalidArgumentException::class);
44
44
$ const = ' ' ;
45
- new ToolParameter (const: $ const );
45
+ new With (const: $ const );
46
46
}
47
47
48
48
#[Test]
49
49
public function validPattern (): void
50
50
{
51
51
$ pattern = '/^[a-z]+$/ ' ;
52
- $ toolParameter = new ToolParameter (pattern: $ pattern );
52
+ $ toolParameter = new With (pattern: $ pattern );
53
53
self ::assertSame ($ pattern , $ toolParameter ->pattern );
54
54
}
55
55
@@ -58,30 +58,30 @@ public function invalidPatternEmptyString(): void
58
58
{
59
59
$ this ->expectException (InvalidArgumentException::class);
60
60
$ pattern = ' ' ;
61
- new ToolParameter (pattern: $ pattern );
61
+ new With (pattern: $ pattern );
62
62
}
63
63
64
64
#[Test]
65
65
public function validMinLength (): void
66
66
{
67
67
$ minLength = 5 ;
68
- $ toolParameter = new ToolParameter (minLength: $ minLength );
68
+ $ toolParameter = new With (minLength: $ minLength );
69
69
self ::assertSame ($ minLength , $ toolParameter ->minLength );
70
70
}
71
71
72
72
#[Test]
73
73
public function invalidMinLengthNegative (): void
74
74
{
75
75
$ this ->expectException (InvalidArgumentException::class);
76
- new ToolParameter (minLength: -1 );
76
+ new With (minLength: -1 );
77
77
}
78
78
79
79
#[Test]
80
80
public function validMinLengthAndMaxLength (): void
81
81
{
82
82
$ minLength = 5 ;
83
83
$ maxLength = 10 ;
84
- $ toolParameter = new ToolParameter (minLength: $ minLength , maxLength: $ maxLength );
84
+ $ toolParameter = new With (minLength: $ minLength , maxLength: $ maxLength );
85
85
self ::assertSame ($ minLength , $ toolParameter ->minLength );
86
86
self ::assertSame ($ maxLength , $ toolParameter ->maxLength );
87
87
}
@@ -90,45 +90,45 @@ public function validMinLengthAndMaxLength(): void
90
90
public function invalidMaxLengthLessThanMinLength (): void
91
91
{
92
92
$ this ->expectException (InvalidArgumentException::class);
93
- new ToolParameter (minLength: 10 , maxLength: 5 );
93
+ new With (minLength: 10 , maxLength: 5 );
94
94
}
95
95
96
96
#[Test]
97
97
public function validMinimum (): void
98
98
{
99
99
$ minimum = 0 ;
100
- $ toolParameter = new ToolParameter (minimum: $ minimum );
100
+ $ toolParameter = new With (minimum: $ minimum );
101
101
self ::assertSame ($ minimum , $ toolParameter ->minimum );
102
102
}
103
103
104
104
#[Test]
105
105
public function invalidMinimumNegative (): void
106
106
{
107
107
$ this ->expectException (InvalidArgumentException::class);
108
- new ToolParameter (minimum: -1 );
108
+ new With (minimum: -1 );
109
109
}
110
110
111
111
#[Test]
112
112
public function validMultipleOf (): void
113
113
{
114
114
$ multipleOf = 5 ;
115
- $ toolParameter = new ToolParameter (multipleOf: $ multipleOf );
115
+ $ toolParameter = new With (multipleOf: $ multipleOf );
116
116
self ::assertSame ($ multipleOf , $ toolParameter ->multipleOf );
117
117
}
118
118
119
119
#[Test]
120
120
public function invalidMultipleOfNegative (): void
121
121
{
122
122
$ this ->expectException (InvalidArgumentException::class);
123
- new ToolParameter (multipleOf: -5 );
123
+ new With (multipleOf: -5 );
124
124
}
125
125
126
126
#[Test]
127
127
public function validExclusiveMinimumAndMaximum (): void
128
128
{
129
129
$ exclusiveMinimum = 1 ;
130
130
$ exclusiveMaximum = 10 ;
131
- $ toolParameter = new ToolParameter (exclusiveMinimum: $ exclusiveMinimum , exclusiveMaximum: $ exclusiveMaximum );
131
+ $ toolParameter = new With (exclusiveMinimum: $ exclusiveMinimum , exclusiveMaximum: $ exclusiveMaximum );
132
132
self ::assertSame ($ exclusiveMinimum , $ toolParameter ->exclusiveMinimum );
133
133
self ::assertSame ($ exclusiveMaximum , $ toolParameter ->exclusiveMaximum );
134
134
}
@@ -137,15 +137,15 @@ public function validExclusiveMinimumAndMaximum(): void
137
137
public function invalidExclusiveMaximumLessThanExclusiveMinimum (): void
138
138
{
139
139
$ this ->expectException (InvalidArgumentException::class);
140
- new ToolParameter (exclusiveMinimum: 10 , exclusiveMaximum: 5 );
140
+ new With (exclusiveMinimum: 10 , exclusiveMaximum: 5 );
141
141
}
142
142
143
143
#[Test]
144
144
public function validMinItemsAndMaxItems (): void
145
145
{
146
146
$ minItems = 1 ;
147
147
$ maxItems = 5 ;
148
- $ toolParameter = new ToolParameter (minItems: $ minItems , maxItems: $ maxItems );
148
+ $ toolParameter = new With (minItems: $ minItems , maxItems: $ maxItems );
149
149
self ::assertSame ($ minItems , $ toolParameter ->minItems );
150
150
self ::assertSame ($ maxItems , $ toolParameter ->maxItems );
151
151
}
@@ -154,29 +154,29 @@ public function validMinItemsAndMaxItems(): void
154
154
public function invalidMaxItemsLessThanMinItems (): void
155
155
{
156
156
$ this ->expectException (InvalidArgumentException::class);
157
- new ToolParameter (minItems: 5 , maxItems: 1 );
157
+ new With (minItems: 5 , maxItems: 1 );
158
158
}
159
159
160
160
#[Test]
161
161
public function validUniqueItemsTrue (): void
162
162
{
163
- $ toolParameter = new ToolParameter (uniqueItems: true );
163
+ $ toolParameter = new With (uniqueItems: true );
164
164
self ::assertTrue ($ toolParameter ->uniqueItems );
165
165
}
166
166
167
167
#[Test]
168
168
public function invalidUniqueItemsFalse (): void
169
169
{
170
170
$ this ->expectException (InvalidArgumentException::class);
171
- new ToolParameter (uniqueItems: false );
171
+ new With (uniqueItems: false );
172
172
}
173
173
174
174
#[Test]
175
175
public function validMinContainsAndMaxContains (): void
176
176
{
177
177
$ minContains = 1 ;
178
178
$ maxContains = 3 ;
179
- $ toolParameter = new ToolParameter (minContains: $ minContains , maxContains: $ maxContains );
179
+ $ toolParameter = new With (minContains: $ minContains , maxContains: $ maxContains );
180
180
self ::assertSame ($ minContains , $ toolParameter ->minContains );
181
181
self ::assertSame ($ maxContains , $ toolParameter ->maxContains );
182
182
}
@@ -185,13 +185,13 @@ public function validMinContainsAndMaxContains(): void
185
185
public function invalidMaxContainsLessThanMinContains (): void
186
186
{
187
187
$ this ->expectException (InvalidArgumentException::class);
188
- new ToolParameter (minContains: 3 , maxContains: 1 );
188
+ new With (minContains: 3 , maxContains: 1 );
189
189
}
190
190
191
191
#[Test]
192
192
public function validRequired (): void
193
193
{
194
- $ toolParameter = new ToolParameter (required: true );
194
+ $ toolParameter = new With (required: true );
195
195
self ::assertTrue ($ toolParameter ->required );
196
196
}
197
197
@@ -200,7 +200,7 @@ public function validMinPropertiesAndMaxProperties(): void
200
200
{
201
201
$ minProperties = 1 ;
202
202
$ maxProperties = 5 ;
203
- $ toolParameter = new ToolParameter (minProperties: $ minProperties , maxProperties: $ maxProperties );
203
+ $ toolParameter = new With (minProperties: $ minProperties , maxProperties: $ maxProperties );
204
204
self ::assertSame ($ minProperties , $ toolParameter ->minProperties );
205
205
self ::assertSame ($ maxProperties , $ toolParameter ->maxProperties );
206
206
}
@@ -209,20 +209,20 @@ public function validMinPropertiesAndMaxProperties(): void
209
209
public function invalidMaxPropertiesLessThanMinProperties (): void
210
210
{
211
211
$ this ->expectException (InvalidArgumentException::class);
212
- new ToolParameter (minProperties: 5 , maxProperties: 1 );
212
+ new With (minProperties: 5 , maxProperties: 1 );
213
213
}
214
214
215
215
#[Test]
216
216
public function validDependentRequired (): void
217
217
{
218
- $ toolParameter = new ToolParameter (dependentRequired: true );
218
+ $ toolParameter = new With (dependentRequired: true );
219
219
self ::assertTrue ($ toolParameter ->dependentRequired );
220
220
}
221
221
222
222
#[Test]
223
223
public function validCombination (): void
224
224
{
225
- $ toolParameter = new ToolParameter (
225
+ $ toolParameter = new With (
226
226
enum: ['value1 ' , 'value2 ' ],
227
227
const: 'constant ' ,
228
228
pattern: '/^[a-z]+$/ ' ,
@@ -244,13 +244,13 @@ enum: ['value1', 'value2'],
244
244
dependentRequired: true
245
245
);
246
246
247
- self ::assertInstanceOf (ToolParameter ::class, $ toolParameter );
247
+ self ::assertInstanceOf (With ::class, $ toolParameter );
248
248
}
249
249
250
250
#[Test]
251
251
public function invalidCombination (): void
252
252
{
253
253
$ this ->expectException (InvalidArgumentException::class);
254
- new ToolParameter (minLength: -1 , maxLength: -2 );
254
+ new With (minLength: -1 , maxLength: -2 );
255
255
}
256
256
}
0 commit comments