@@ -134,22 +134,19 @@ public function testUpsertVarbinary()
134134 {
135135 $ db = $ this ->getConnection ();
136136
137- $ testData = json_encode (['test ' => 'string ' , 'test2 ' => 'integer ' ]);
138- $ params = [];
139-
140137 $ qb = $ db ->getQueryBuilder ();
141- $ sql = $ qb -> upsert ( ' T_upsert_varbinary ' , [ ' id ' => 1 , ' blob_col ' => $ testData ] , [ ' blob_col ' => $ testData ], $ params );
138+ $ testData = json_encode ([ ' test ' => ' string ' , ' test2 ' => ' integer ' ], JSON_THROW_ON_ERROR );
142139
143- $ result = $ db -> createCommand ( $ sql , $ params )-> execute () ;
140+ $ params = [] ;
144141
145- $ this ->assertEquals (1 , $ result );
142+ $ sql = $ qb ->upsert ('T_upsert_varbinary ' , ['id ' => 1 , 'blob_col ' => $ testData ], ['blob_col ' => $ testData ], $ params );
143+ $ result = $ db ->createCommand ($ sql , $ params )->execute ();
146144
147- $ query = (new Query ())
148- ->select (['convert(nvarchar(max),blob_col) as blob_col ' ])
149- ->from ('T_upsert_varbinary ' )
150- ->where (['id ' => 1 ]);
145+ $ this ->assertSame (1 , $ result );
151146
147+ $ query = (new Query ())->select (['blob_col ' ])->from ('T_upsert_varbinary ' )->where (['id ' => 1 ]);
152148 $ resultData = $ query ->createCommand ($ db )->queryOne ();
153- $ this ->assertEquals ($ testData , $ resultData ['blob_col ' ]);
149+
150+ $ this ->assertSame ($ testData , $ resultData ['blob_col ' ]);
154151 }
155152}
0 commit comments