88use Bolt \tests \PackStream \v1 \generators \RandomDataGenerator ;
99use PHPUnit \Framework \TestCase ;
1010
11+ /**
12+ * Class PerformanceTest
13+ * @author Ghlen Nagels
14+ * @link https://github.com/neo4j-php/Bolt
15+ * @package Bolt\tests
16+ */
1117class PerformanceTest extends TestCase
1218{
1319 public function test50KRecords (): void
1420 {
1521 $ amount = 50000 ;
1622
17- $ conn = new StreamSocket ($ GLOBALS ['NEO_HOST ' ] ?? 'localhost ' , $ GLOBALS ['NEO_PORT ' ] ?? 7687 );
18- $ protocol = (new Bolt ($ conn ))->build ();
19- $ this ->assertNotEmpty ($ protocol ->init (Auth::basic ($ GLOBALS ['NEO_USER ' ], $ GLOBALS ['NEO_PASS ' ])));
23+ try {
24+ $ conn = new StreamSocket ($ GLOBALS ['NEO_HOST ' ] ?? 'localhost ' , $ GLOBALS ['NEO_PORT ' ] ?? 7687 );
25+ $ protocol = (new Bolt ($ conn ))->build ();
26+ $ this ->assertNotEmpty ($ protocol ->init (Auth::basic ($ GLOBALS ['NEO_USER ' ], $ GLOBALS ['NEO_PASS ' ])));
2027
21- $ generator = new RandomDataGenerator ($ amount );
22- $ protocol ->run ('UNWIND $x as x RETURN x ' , ['x ' => $ generator ]);
28+ $ generator = new RandomDataGenerator ($ amount );
29+ $ protocol ->run ('UNWIND $x as x RETURN x ' , ['x ' => $ generator ]);
2330
24- $ count = 0 ;
25- while ($ count < $ amount ) {
26- ++$ count ;
27- $ protocol ->pull (['n ' => 1 ]);
28- }
31+ $ count = 0 ;
32+ while ($ count < $ amount ) {
33+ ++$ count ;
34+ $ protocol ->pullAll (['n ' => 1 ]);
35+ }
2936
30- $ this ->assertEquals ($ amount , $ count );
37+ $ this ->assertEquals ($ amount , $ count );
38+ } catch (\Exception $ e ) {
39+ $ this ->markTestIncomplete ($ e ->getMessage ());
40+ }
3141 }
32- }
42+ }
0 commit comments