/** * Tests the JApplicationDaemon::writeProcessIdFile method. * * @return void * * @since 11.3 */ public function testWriteProcessIdFile() { $pidPath = JPATH_BASE . '/japplicationdaemontest.pid'; if (file_exists($pidPath)) { unlink($pidPath); } // We set a custom process id file path so that we don't interfere // with other tests that are running on a system $this->inspector->set('application_pid_file', $pidPath); // Get the current process id and set it to the daemon instance. $pid = (int) posix_getpid(); $this->inspector->setClassProperty('processId', $pid); // Execute the writeProcessIdFile method. $this->inspector->writeProcessIdFile(); // Check the value of the file. $this->assertEquals( $pid, (int) file_get_contents($this->inspector->getClassProperty('config')->get('application_pid_file')), 'Line: ' . __LINE__ ); // Check the permissions on the file. $this->assertEquals( '0644', substr(decoct(fileperms($this->inspector->getClassProperty('config')->get('application_pid_file'))), 1), 'Line: ' . __LINE__ ); }
/** * Method for setting protected static $signals. * * @param mixed $value The value of the property. * * @return void. * * @since 11.3 */ public function setClassSignals(array $value) { self::$signals = $value; }