public function mockObject($objectClassName, ...$configurations)
    {
        foreach ($configurations as &$configuration) {
            $this->prepareMockConfig($configuration);
        }

        $config = call_user_func_array('array_replace_recursive', $configurations);

        $willReturn = $this->pullOutArrayValue($config, 'willReturn', []);
        $will = $this->pullOutArrayValue($config, 'will');
        $mockType = $this->pullOutArrayValue($config, 'mockType', self::MOCK_TYPE_DEFAULT);

        // 'methods' must be null for 'getMock' to not replace any element
        // (unlike 'getMockForAbstractClass')
        if (empty($config['methods'])) {
            if ($mockType == self::MOCK_TYPE_DEFAULT) {
                $config['methods'] = null;
            }
        }

        $mockBuilder = $this->testCase->getMockBuilder($objectClassName);

        foreach ($config as $property => $value) {
            $method = "set$property";
            if (method_exists($mockBuilder, $method)) {
                $mockBuilder->$method($value);
            }
        }

        if ($this->getArrayValue($config, 'disableOriginalConstructor', true)) {
            $mockBuilder->disableOriginalConstructor();
        }

        $mockMethod = $this->getMockMethod($mockType);
        /** @var \PHPUnit_Framework_MockObject_MockObject $mock */
        $mock = $mockBuilder->$mockMethod();

        foreach ($willReturn as $method => $value) {
            $mock->method($method)->willReturn($value);
        }

        foreach ($will as $method => $value) {
            $mock->method($method)->will($value);
        }

        return $mock;
    }