public function testRegisterProcessTerminatesExisting() { $pidFolder = 'mfs://stubber/process'; $this->mockFs->getFileSystem()->addDirectory('process', '/stubber'); $this->mockFs->getFileSystem()->addFile('127.0.0.1:8080', 1234, '/stubber/process'); $this->mockFilesystem->shouldReceive('exists')->with($pidFolder)->andReturn(true); $this->mockFilesystem->shouldReceive('remove')->with($pidFolder . '/127.0.0.1:8080')->andReturn(true); $processManager = new ProcessManager($this->mockFilesystem, $this->mockFinder, $pidFolder); $processManager->registerProcess(new Process(1234), '127.0.0.1', 'mock'); $this->assertSame('1234', file_get_contents($pidFolder . '/127.0.0.1:mock')); }
public function testIsExecutableByWorld() { $mockFs = new MockFs(); $mockFs->getFileSystem()->addDirectory('Directory'); $directory = $mockFs->getFileSystem()->getChild('Directory'); $directory->setPermissions(01)->setOwnerId(100)->setGroupId(200); $this->assertFalse($directory->isExecutable(100)); $this->assertFalse($directory->isExecutable(50, 200)); $this->assertTrue($directory->isExecutable(50, 50)); }
protected function getMockRepoPath() { $mockFs = new MockFs(); $mockFs->getFileSystem()->addDirectory('repos')->addDirectory('php-git', '/repos')->addDirectory('.git', "/repos/php-git"); return 'mfs://repos/php-git'; }