*/ class MonitorCacheServiceTest extends DeliveryMonitoringServiceTest { public function setUp(): void { \common_ext_ExtensionsManager::singleton()->getExtensionById('taoDelivery'); TaoPhpUnitTestRunner::initTest(); $service = ServiceManager::getServiceManager()->get(MonitorCacheService::CONFIG_ID); $this->service = new MonitorCacheService($service->getOptions()); $this->persistence = \common_persistence_Manager::getPersistence('default'); if (!extension_loaded('pthreads')) { $this->markTestSkipped( 'Pthreads extension is not available.' ); } } /** * Test concurrent queries to the storage */ public function testSaveConcurrent() { $fails = 0; $service = $this->service; for ($i = 0; $i < 100; $i++) { $workers[$i]= new MonitorCacheServiceThread($service); $workers[$i]->start(0); } foreach ($workers as $worker) { $worker->join(); if ($worker->isFailed()) { $fails++; } } $this->assertEquals(0, $fails); } }