Skip to content

Running with --process-isolation breaks semantics of setUpBeforeClass() #8

@jakubkulhan

Description

@jakubkulhan

With --process-isolation setUpBeforeClass() is not run before tests, but instead for each test.

<?php
require 'PHPUnit/Framework/TestCase.php';

class FooTest extends PHPUnit_Framework_TestCase
{
    static function setUpBeforeClass()
    {
        echo "setUpBeforeClass, pid=" . getmypid() . "\n";
    }

    function testA()
    {
        echo "testA, pid=" . getmypid() . "\n";
        $this->assertTrue(TRUE);
    }

    function testB()
    {
        echo "testB, pid=" . getmypid() . "\n";
        $this->assertTrue(TRUE);
    }
}

Expected output:

PHPUnit 3.5.0RC1 by Sebastian Bergmann.

setUpBeforeClass, pid=23871
testA, pid=23872
.testB, pid=23873
.

Time: 0 seconds, Memory: 3.50Mb

OK (2 tests, 2 assertions)

Actual output:

PHPUnit 3.5.0RC1 by Sebastian Bergmann.

setUpBeforeClass, pid=23882
setUpBeforeClass, pid=23883
testA, pid=23883
.setUpBeforeClass, pid=23884
testB, pid=23884
.

Time: 1 second, Memory: 3.50Mb

OK (2 tests, 2 assertions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions