Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit47081da

Browse files
committed
Allow resources in Query::setParam
1 parent3835573 commit47081da

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

‎src/Symfony/Bridge/Doctrine/Middleware/Debug/Query.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function stop(): void
4343
}
4444
}
4545

46-
publicfunctionsetParam(string|int$param,null|string|int|float|bool &$variable,int$type):void
46+
publicfunctionsetParam(string|int$param,mixed &$variable,int$type):void
4747
{
4848
// Numeric indexes start at 0 in profiler
4949
$idx =\is_int($param) ?$param -1 :$param;

‎src/Symfony/Bridge/Doctrine/Tests/Middleware/Debug/MiddlewareTest.php‎

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,23 +145,32 @@ public function testWithParamBound(callable $executeMethod)
145145
{
146146
$this->init();
147147

148-
$product ='product1';
149-
$price =12.5;
150-
$stock =5;
148+
$sql =<<<EOT
149+
INSERT INTO products(name, price, stock, picture, tags)
150+
VALUES (?, ?, ?, ?, ?)
151+
EOT;
152+
153+
$expectedRes =$res =$this->getResourceFromString('mydata');
151154

152-
$stmt =$this->conn->prepare('INSERT INTO products(name, price, stock) VALUES (?, ?, ?)');
155+
$stmt =$this->conn->prepare($sql);
153156
$stmt->bindParam(1,$product);
154157
$stmt->bindParam(2,$price);
155158
$stmt->bindParam(3,$stock, ParameterType::INTEGER);
159+
$stmt->bindParam(4,$res, ParameterType::BINARY);
160+
161+
$product ='product1';
162+
$price =12.5;
163+
$stock =5;
164+
156165

157166
$executeMethod($stmt);
158167

159168
// Debug data should not be affected by these changes
160169
$debug =$this->debugDataHolder->getData()['default'] ?? [];
161170
$this->assertCount(2,$debug);
162-
$this->assertSame('INSERT INTO products(name, price, stock) VALUES (?, ?, ?)',$debug[1]['sql']);
163-
$this->assertSame(['product1','12.5',5],$debug[1]['params']);
164-
$this->assertSame([ParameterType::STRING, ParameterType::STRING, ParameterType::INTEGER],$debug[1]['types']);
171+
$this->assertSame($sql,$debug[1]['sql']);
172+
$this->assertSame(['product1',12.5,5,$expectedRes],$debug[1]['params']);
173+
$this->assertSame([ParameterType::STRING, ParameterType::STRING, ParameterType::INTEGER, ParameterType::BINARY],$debug[1]['types']);
165174
$this->assertGreaterThan(0,$debug[1]['executionMS']);
166175
}
167176

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp