@@ -479,4 +479,177 @@ public function testActiveQueriesPaneRenderWithEmptyQueries(): void
479479 $ this ->assertIsString ($ output );
480480 $ this ->assertStringContainsString ('No active queries ' , $ output );
481481 }
482+
483+ public function testConnectionPoolPaneRenderFullscreen (): void
484+ {
485+ ob_start ();
486+ ConnectionPoolPane::render (
487+ self ::$ db ,
488+ $ this ->layout ,
489+ Layout::PANE_CONNECTIONS ,
490+ true ,
491+ 0 ,
492+ 0 ,
493+ true
494+ );
495+ $ output = ob_get_clean ();
496+ $ this ->assertIsString ($ output );
497+ }
498+
499+ public function testConnectionPoolPaneRenderWithConnectionsData (): void
500+ {
501+ $ connectionsData = [
502+ 'connections ' => [
503+ ['id ' => '1 ' , 'user ' => 'test ' , 'database ' => 'test_db ' ],
504+ ],
505+ 'summary ' => [
506+ 'current ' => 1 ,
507+ 'max ' => 100 ,
508+ 'usage_percent ' => 1.0 ,
509+ ],
510+ ];
511+ ob_start ();
512+ ConnectionPoolPane::render (
513+ self ::$ db ,
514+ $ this ->layout ,
515+ Layout::PANE_CONNECTIONS ,
516+ true ,
517+ 0 ,
518+ 0 ,
519+ false ,
520+ $ connectionsData
521+ );
522+ $ output = ob_get_clean ();
523+ $ this ->assertIsString ($ output );
524+ }
525+
526+ public function testConnectionPoolPaneRenderWithSelectedIndex (): void
527+ {
528+ $ connectionsData = [
529+ 'connections ' => [
530+ ['id ' => '1 ' , 'user ' => 'test ' , 'database ' => 'test_db ' ],
531+ ['id ' => '2 ' , 'user ' => 'test2 ' , 'database ' => 'test_db2 ' ],
532+ ],
533+ 'summary ' => [
534+ 'current ' => 2 ,
535+ 'max ' => 100 ,
536+ 'usage_percent ' => 2.0 ,
537+ ],
538+ ];
539+ ob_start ();
540+ ConnectionPoolPane::render (
541+ self ::$ db ,
542+ $ this ->layout ,
543+ Layout::PANE_CONNECTIONS ,
544+ true ,
545+ 1 ,
546+ 0 ,
547+ false ,
548+ $ connectionsData
549+ );
550+ $ output = ob_get_clean ();
551+ $ this ->assertIsString ($ output );
552+ }
553+
554+ public function testSchemaBrowserPaneRenderPreview (): void
555+ {
556+ $ reflection = new \ReflectionClass (SchemaBrowserPane::class);
557+ $ method = $ reflection ->getMethod ('renderPreview ' );
558+ $ method ->setAccessible (true );
559+
560+ $ content = ['row ' => 1 , 'col ' => 1 , 'height ' => 5 , 'width ' => 80 ];
561+ $ tables = [
562+ ['name ' => 'users ' , 'count ' => 10 ],
563+ ['name ' => 'posts ' , 'count ' => 20 ],
564+ ];
565+ ob_start ();
566+ $ method ->invoke (null , $ content , $ tables );
567+ $ output = ob_get_clean ();
568+ $ this ->assertIsString ($ output );
569+ }
570+
571+ public function testSchemaBrowserPaneRenderFullscreen (): void
572+ {
573+ $ reflection = new \ReflectionClass (SchemaBrowserPane::class);
574+ $ method = $ reflection ->getMethod ('renderFullscreen ' );
575+ $ method ->setAccessible (true );
576+
577+ $ content = ['row ' => 1 , 'col ' => 1 , 'height ' => 24 , 'width ' => 80 ];
578+ $ tables = [
579+ ['name ' => 'users ' , 'count ' => 10 ],
580+ ['name ' => 'posts ' , 'count ' => 20 ],
581+ ];
582+ ob_start ();
583+ $ method ->invoke (null , self ::$ db , $ content , $ tables , 0 , 0 , true , null );
584+ $ output = ob_get_clean ();
585+ $ this ->assertIsString ($ output );
586+ }
587+
588+ public function testSchemaBrowserPaneRenderFullscreenWithSearchFilter (): void
589+ {
590+ $ reflection = new \ReflectionClass (SchemaBrowserPane::class);
591+ $ method = $ reflection ->getMethod ('renderFullscreen ' );
592+ $ method ->setAccessible (true );
593+
594+ $ content = ['row ' => 1 , 'col ' => 1 , 'height ' => 24 , 'width ' => 80 ];
595+ $ tables = [
596+ ['name ' => 'users ' , 'count ' => 10 ],
597+ ['name ' => 'posts ' , 'count ' => 20 ],
598+ ];
599+ ob_start ();
600+ $ method ->invoke (null , self ::$ db , $ content , $ tables , 0 , 0 , true , 'user ' );
601+ $ output = ob_get_clean ();
602+ $ this ->assertIsString ($ output );
603+ }
604+
605+ public function testServerVariablesPaneRenderPreview (): void
606+ {
607+ $ reflection = new \ReflectionClass (ServerVariablesPane::class);
608+ $ method = $ reflection ->getMethod ('renderPreview ' );
609+ $ method ->setAccessible (true );
610+
611+ $ content = ['row ' => 1 , 'col ' => 1 , 'height ' => 5 , 'width ' => 80 ];
612+ $ variables = [
613+ ['name ' => 'max_connections ' , 'value ' => '100 ' ],
614+ ['name ' => 'thread_cache_size ' , 'value ' => '8 ' ],
615+ ];
616+ ob_start ();
617+ $ method ->invoke (null , $ content , $ variables );
618+ $ output = ob_get_clean ();
619+ $ this ->assertIsString ($ output );
620+ }
621+
622+ public function testServerVariablesPaneRenderFullscreen (): void
623+ {
624+ $ reflection = new \ReflectionClass (ServerVariablesPane::class);
625+ $ method = $ reflection ->getMethod ('renderFullscreen ' );
626+ $ method ->setAccessible (true );
627+
628+ $ content = ['row ' => 1 , 'col ' => 1 , 'height ' => 24 , 'width ' => 80 ];
629+ $ variables = [
630+ ['name ' => 'max_connections ' , 'value ' => '100 ' ],
631+ ['name ' => 'thread_cache_size ' , 'value ' => '8 ' ],
632+ ];
633+ ob_start ();
634+ $ method ->invoke (null , $ content , $ variables , 0 , 0 , true , null );
635+ $ output = ob_get_clean ();
636+ $ this ->assertIsString ($ output );
637+ }
638+
639+ public function testServerVariablesPaneRenderFullscreenWithSearchFilter (): void
640+ {
641+ $ reflection = new \ReflectionClass (ServerVariablesPane::class);
642+ $ method = $ reflection ->getMethod ('renderFullscreen ' );
643+ $ method ->setAccessible (true );
644+
645+ $ content = ['row ' => 1 , 'col ' => 1 , 'height ' => 24 , 'width ' => 80 ];
646+ $ variables = [
647+ ['name ' => 'max_connections ' , 'value ' => '100 ' ],
648+ ['name ' => 'thread_cache_size ' , 'value ' => '8 ' ],
649+ ];
650+ ob_start ();
651+ $ method ->invoke (null , $ content , $ variables , 0 , 0 , true , 'max ' );
652+ $ output = ob_get_clean ();
653+ $ this ->assertIsString ($ output );
654+ }
482655}
0 commit comments