Unverified Commit eecc0efc authored by alexpott's avatar alexpott
Browse files

Issue #3088447 by Mile23, heddn, Krzysztof Domański:...

Issue #3088447 by Mile23, heddn, Krzysztof Domański: BuildTestBase->standUpServer always starts new server
parent 44b124ac
......@@ -382,9 +382,11 @@ protected function standUpServer($working_dir = NULL) {
$this->stopServer();
}
// If there's not a server at this point, make one.
$this->serverProcess = $this->instantiateServer($this->getPortNumber(), $working_dir);
if ($this->serverProcess) {
$this->serverDocroot = $working_dir;
if (!$this->serverProcess || $this->serverProcess->isTerminated()) {
$this->serverProcess = $this->instantiateServer($this->getPortNumber(), $working_dir);
if ($this->serverProcess) {
$this->serverDocroot = $working_dir;
}
}
}
......
......@@ -154,4 +154,35 @@ public function testPortMany() {
}
}
/**
* @covers ::standUpServer
*/
public function testStandUpServer() {
// Stand up a server with working directory 'first'.
$this->standUpServer('first');
// Get the process object for the server.
$ref_process = new \ReflectionProperty(parent::class, 'serverProcess');
$ref_process->setAccessible(TRUE);
$first_process = $ref_process->getValue($this);
// Standing up the server again should not change the server process.
$this->standUpServer('first');
$this->assertSame($first_process, $ref_process->getValue($this));
// Standing up the server with working directory 'second' should give us a
// new server process.
$this->standUpServer('second');
$this->assertNotSame(
$first_process,
$second_process = $ref_process->getValue($this)
);
// And even with the original working directory name, we should get a new
// server process.
$this->standUpServer('first');
$this->assertNotSame($first_process, $ref_process->getValue($this));
$this->assertNotSame($second_process, $ref_process->getValue($this));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment