@@ -24,34 +24,36 @@ protected function tearDown(): void
24
24
}
25
25
26
26
#[Dataprovider('provideFunctionNames ' )]
27
- public function testCallingABuilderMethodDoesNotReturnTheBuilderInstance (string $ method , string $ className , $ parameters = []): void
27
+ public function testCallingABuilderMethodDoesNotReturnTheBuilderInstance (string $ method , $ parameters = []): void
28
28
{
29
29
$ builder = User::query ()->newQuery ();
30
30
assert ($ builder instanceof Builder);
31
31
32
- self ::assertNotInstanceOf (expected: $ className , actual: $ builder ->{$ method }(...$ parameters ));
32
+ self ::assertNotInstanceOf (Builder::class, $ builder ->{$ method }(...$ parameters ));
33
33
}
34
34
35
35
public static function provideFunctionNames (): Generator
36
36
{
37
- yield 'does not exist ' => ['doesntExist ' , Builder::class];
38
- yield 'get bindings ' => ['getBindings ' , Builder::class];
39
- yield 'get connection ' => ['getConnection ' , Builder::class];
40
- yield 'get grammar ' => ['getGrammar ' , Builder::class];
41
- yield 'insert get id ' => ['insertGetId ' , Builder::class, [['user ' => 'foo ' ]]];
42
- yield 'to Mql ' => ['toMql ' , Builder::class];
43
- yield 'average ' => ['average ' , Builder::class, ['name ' ]];
44
- yield 'avg ' => ['avg ' , Builder::class, ['name ' ]];
45
- yield 'count ' => ['count ' , Builder::class, ['name ' ]];
46
- yield 'exists ' => ['exists ' , Builder::class];
47
- yield 'insert ' => ['insert ' , Builder::class, [['name ' ]]];
48
- yield 'max ' => ['max ' , Builder::class, ['name ' ]];
49
- yield 'min ' => ['min ' , Builder::class, ['name ' ]];
50
- yield 'pluck ' => ['pluck ' , Builder::class, ['name ' ]];
51
- yield 'pull ' => ['pull ' , Builder::class, ['name ' ]];
52
- yield 'push ' => ['push ' , Builder::class, ['name ' ]];
53
- yield 'raw ' => ['raw ' , Builder::class];
54
- yield 'sum ' => ['sum ' , Builder::class, ['name ' ]];
37
+ yield 'does not exist ' => ['doesntExist ' ];
38
+ yield 'get bindings ' => ['getBindings ' ];
39
+ yield 'get connection ' => ['getConnection ' ];
40
+ yield 'get grammar ' => ['getGrammar ' ];
41
+ yield 'insert get id ' => ['insertGetId ' , [['user ' => 'foo ' ]]];
42
+ yield 'to Mql ' => ['toMql ' ];
43
+ yield 'to Sql ' => ['toSql ' ];
44
+ yield 'to Raw Sql ' => ['toRawSql ' ];
45
+ yield 'average ' => ['average ' , ['name ' ]];
46
+ yield 'avg ' => ['avg ' , ['name ' ]];
47
+ yield 'count ' => ['count ' , ['name ' ]];
48
+ yield 'exists ' => ['exists ' ];
49
+ yield 'insert ' => ['insert ' , [['name ' ]]];
50
+ yield 'max ' => ['max ' , ['name ' ]];
51
+ yield 'min ' => ['min ' , ['name ' ]];
52
+ yield 'pluck ' => ['pluck ' , ['name ' ]];
53
+ yield 'pull ' => ['pull ' , ['name ' ]];
54
+ yield 'push ' => ['push ' , ['name ' ]];
55
+ yield 'raw ' => ['raw ' ];
56
+ yield 'sum ' => ['sum ' , ['name ' ]];
55
57
}
56
58
57
59
#[Test]
@@ -79,14 +81,7 @@ public static function provideUnsupportedMethods(): Generator
79
81
yield 'insert using ' => [
80
82
'insertUsing ' ,
81
83
BadMethodCallException::class,
82
- 'This method is not supported by MongoDB. Try "toMql()" instead ' ,
83
- [[['name ' => 'Jane ' ]], fn (QueryBuilder $ builder ) => $ builder ],
84
- ];
85
-
86
- yield 'to sql ' => [
87
- 'toSql ' ,
88
- BadMethodCallException::class,
89
- 'This method is not supported by MongoDB. Try "toMql()" instead ' ,
84
+ 'This method is not supported by MongoDB ' ,
90
85
[[['name ' => 'Jane ' ]], fn (QueryBuilder $ builder ) => $ builder ],
91
86
];
92
87
}
0 commit comments