55namespace PhpDbTest \Sql ;
66
77use Override ;
8+ use PhpDb \Adapter \Adapter ;
89use PhpDb \Adapter \Driver \DriverInterface ;
10+ use PhpDb \Adapter \Driver \StatementInterface ;
911use PhpDb \Adapter \ParameterContainer ;
1012use PhpDb \Adapter \StatementContainer ;
1113use PhpDb \Sql \AbstractSql ;
1214use PhpDb \Sql \Argument ;
1315use PhpDb \Sql \Argument \Identifier ;
16+ use PhpDb \Sql \ArgumentInterface ;
17+ use PhpDb \Sql \ArgumentType ;
18+ use PhpDb \Sql \Exception \InvalidArgumentException ;
1419use PhpDb \Sql \Exception \RuntimeException ;
1520use PhpDb \Sql \Expression ;
1621use PhpDb \Sql \ExpressionInterface ;
22+ use PhpDb \Sql \Join ;
1723use PhpDb \Sql \Predicate ;
1824use PhpDb \Sql \Select ;
1925use PhpDb \Sql \TableIdentifier ;
26+ use PhpDbTest \TestAsset \SelectDecorator ;
2027use PhpDbTest \TestAsset \TrustingSql92Platform ;
2128use PHPUnit \Framework \Attributes \CoversMethod ;
2229use PHPUnit \Framework \Attributes \Group ;
@@ -435,7 +442,7 @@ protected function invokeProcessExpressionMethod(
435442 */
436443 public function testProcessJoinWithArrayAlias (): void
437444 {
438- $ join = new \ PhpDb \ Sql \ Join ();
445+ $ join = new Join ();
439446 $ join ->join (['b ' => 'bar ' ], 'foo.id = b.foo_id ' );
440447
441448 $ method = new ReflectionMethod ($ this ->abstractSql , 'processJoin ' );
@@ -456,8 +463,8 @@ public function testProcessJoinWithArrayAlias(): void
456463 */
457464 public function testProcessJoinWithTableIdentifier (): void
458465 {
459- $ join = new \ PhpDb \ Sql \ Join ();
460- $ join ->join (new \ PhpDb \ Sql \ TableIdentifier ('bar ' , 'myschema ' ), 'foo.id = bar.foo_id ' );
466+ $ join = new Join ();
467+ $ join ->join (new TableIdentifier ('bar ' , 'myschema ' ), 'foo.id = bar.foo_id ' );
461468
462469 $ method = new ReflectionMethod ($ this ->abstractSql , 'processJoin ' );
463470 $ result = $ method ->invoke (
@@ -478,7 +485,7 @@ public function testProcessJoinWithTableIdentifier(): void
478485 */
479486 public function testProcessJoinWithPredicateExpressionOnClause (): void
480487 {
481- $ join = new \ PhpDb \ Sql \ Join ();
488+ $ join = new Join ();
482489 $ join ->join ('bar ' , new Predicate \Expression ('foo.id = bar.foo_id AND bar.active = 1 ' ));
483490
484491 $ method = new ReflectionMethod ($ this ->abstractSql , 'processJoin ' );
@@ -527,7 +534,7 @@ public function testRenderTableWithAlias(): void
527534 */
528535 public function testProcessJoinWithExpressionNameViaArray (): void
529536 {
530- $ join = new \ PhpDb \ Sql \ Join ();
537+ $ join = new Join ();
531538 $ join ->join (['x ' => new Expression ('LATERAL(SELECT 1) ' )], 'true ' );
532539
533540 $ method = new ReflectionMethod ($ this ->abstractSql , 'processJoin ' );
@@ -548,7 +555,7 @@ public function testProcessJoinWithExpressionNameViaArray(): void
548555 public function testProcessJoinWithSelectSubqueryViaArray (): void
549556 {
550557 $ subselect = new Select ('bar ' );
551- $ join = new \ PhpDb \ Sql \ Join ();
558+ $ join = new Join ();
552559 $ join ->join (['b ' => $ subselect ], 'foo.id = b.foo_id ' );
553560
554561 $ method = new ReflectionMethod ($ this ->abstractSql , 'processJoin ' );
@@ -644,10 +651,10 @@ public function testCreateSqlFromSpecNonCombinedByThrowsOnUnsupportedCount(): vo
644651
645652 public function testProcessExpressionThrowsOnUnknownArgumentType (): void
646653 {
647- $ unknownArg = new class implements \ PhpDb \ Sql \ ArgumentInterface {
648- public function getType (): \ PhpDb \ Sql \ ArgumentType
654+ $ unknownArg = new class implements ArgumentInterface {
655+ public function getType (): ArgumentType
649656 {
650- return \ PhpDb \ Sql \ ArgumentType::Value;
657+ return ArgumentType::Value;
651658 }
652659
653660 public function getValue (): string
@@ -663,7 +670,7 @@ public function getSpecification(): string
663670
664671 $ expression = new Expression ('? ' , [$ unknownArg ]);
665672
666- $ this ->expectException (\ PhpDb \ Sql \ Exception \ InvalidArgumentException::class);
673+ $ this ->expectException (InvalidArgumentException::class);
667674 $ this ->expectExceptionMessage ('Unknown argument type ' );
668675 $ this ->invokeProcessExpressionMethod ($ expression );
669676 }
@@ -679,11 +686,11 @@ public function testResolveColumnValueWithNamedParameterPrefix(): void
679686 ->willReturnCallback (fn (string $ name ): string => ': ' . $ name );
680687
681688 $ parameterContainer = new ParameterContainer ();
682- $ mockStatement = $ this ->createMock (\ PhpDb \ Adapter \ Driver \ StatementInterface::class);
689+ $ mockStatement = $ this ->createMock (StatementInterface::class);
683690 $ mockStatement ->method ('getParameterContainer ' )->willReturn ($ parameterContainer );
684691 $ mockStatement ->method ('setSql ' )->willReturnSelf ();
685692
686- $ adapter = $ this ->getMockBuilder (\ PhpDb \ Adapter \ Adapter::class)
693+ $ adapter = $ this ->getMockBuilder (Adapter::class)
687694 ->setConstructorArgs ([$ mockDriver , new TrustingSql92Platform ()])
688695 ->getMock ();
689696 $ adapter ->method ('getDriver ' )->willReturn ($ mockDriver );
@@ -696,7 +703,7 @@ public function testResolveColumnValueWithNamedParameterPrefix(): void
696703
697704 public function testLocalizeVariablesCopiesSubjectProperties (): void
698705 {
699- $ decorator = new \ PhpDbTest \ TestAsset \ SelectDecorator ();
706+ $ decorator = new SelectDecorator ();
700707 $ select = new Select ('users ' );
701708 $ select ->columns (['id ' , 'name ' ]);
702709 $ decorator ->setSubject ($ select );
@@ -709,7 +716,7 @@ public function testLocalizeVariablesCopiesSubjectProperties(): void
709716
710717 public function testProcessSubSelectUsesDecoratorWhenPlatformDecorator (): void
711718 {
712- $ decorator = new \ PhpDbTest \ TestAsset \ SelectDecorator ();
719+ $ decorator = new SelectDecorator ();
713720 $ outer = new Select ('foo ' );
714721 $ outer ->where (['x ' => new Select ('bar ' )]);
715722
@@ -741,10 +748,10 @@ public function testFlattenExpressionValuesViaInPredicateWithParameterContainer(
741748 ->willReturnCallback (fn (string $ name ): string => ': ' . $ name );
742749
743750 $ parameterContainer = new ParameterContainer ();
744- $ mockStatement = $ this ->createMock (\ PhpDb \ Adapter \ Driver \ StatementInterface::class);
751+ $ mockStatement = $ this ->createMock (StatementInterface::class);
745752 $ mockStatement ->method ('getParameterContainer ' )->willReturn ($ parameterContainer );
746753
747- $ adapter = $ this ->getMockBuilder (\ PhpDb \ Adapter \ Adapter::class)
754+ $ adapter = $ this ->getMockBuilder (Adapter::class)
748755 ->setConstructorArgs ([$ mockDriver , new TrustingSql92Platform ()])
749756 ->getMock ();
750757 $ adapter ->method ('getDriver ' )->willReturn ($ mockDriver );
0 commit comments