@@ -73,26 +73,42 @@ public function testResetName(): void
7373 $ this ->assertMatchesRegularExpression ('/\w{2}\d{3}/ ' , $ name2 );
7474 }
7575
76+ /**
77+ * PHPUnit ^10.5 has an issue with
78+ * $this->assertArrayNotHasKey($name, $names, sprintf...
79+ * that leads to test timeouts. This is fixed in PHPUnit ^11.
80+ * Revert workaround
81+ * $this->assertFalse(isset($names[$name]), sprintf...
82+ * when upgrading.
83+ */
7684 public function testNameArentRecycled (): void
7785 {
7886 $ names = [];
7987
8088 for ($ i = 0 ; $ i < 10000 ; $ i ++) {
8189 $ name = $ this ->robot ->getName ();
82- $ this ->assertArrayNotHasKey ( $ name , $ names , sprintf ('Name %s reissued after Reset. ' , $ name ));
90+ $ this ->assertFalse ( isset ( $ names[ $ name ]) , sprintf ('Name %s reissued after Reset. ' , $ name ));
8391 $ names [$ name ] = true ;
8492 $ this ->robot ->reset ();
8593 }
8694 }
8795
96+ /**
97+ * PHPUnit ^10.5 has an issue with
98+ * $this->assertArrayNotHasKey($name, $names, sprintf...
99+ * that leads to test timeouts. This is fixed in PHPUnit ^11.
100+ * Revert workaround
101+ * $this->assertFalse(isset($names[$name]), sprintf...
102+ * when upgrading.
103+ */
88104 // This test is optional.
89105 public function testNameUniquenessManyRobots (): void
90106 {
91107 $ names = [];
92108
93109 for ($ i = 0 ; $ i < 10000 ; $ i ++) {
94110 $ name = (new Robot ())->getName ();
95- $ this ->assertArrayNotHasKey ( $ name , $ names , sprintf ('Name %s reissued after %d robots ' , $ name , $ i ));
111+ $ this ->assertFalse ( isset ( $ names[ $ name ]) , sprintf ('Name %s reissued after %d robots ' , $ name , $ i ));
96112 $ names [$ name ] = true ;
97113 }
98114 }
0 commit comments