This file is indexed.

/usr/share/php/tests/Horde_Injector/Horde/Injector/Binder/ClosureTest.php is in php-horde-injector 2.0.2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
class Horde_Injector_Binder_ClosureTest extends Horde_Test_Case
{
    public function testShouldCallClosure()
    {
        $childInjector = $this->getMockSkipConstructor('Horde_Injector', array('createInstance', 'getInstance'));
        $injector = $this->getMockSkipConstructor('Horde_Injector', array('createChildInjector'));
        $injector->expects($this->once())
            ->method('createChildInjector')
            ->with()
            ->will($this->returnValue($childInjector));

        $closureBinder = new Horde_Injector_Binder_Closure(
            function (Horde_Injector $injector) { return 'INSTANCE'; }
        );

        $this->assertEquals('INSTANCE', $closureBinder->create($injector));
    }

    /**
     * The closure binder should pass a child injector object to the closure, so that
     * any configuration that happens in the closure will not bleed into global scope
     */
    public function testShouldPassChildInjectorToClosure()
    {
        $closure = function (Horde_Injector $injector) { return $injector; };

        $binder = new Horde_Injector_Binder_Closure($closure);

        $injector = new ClosureInjectorMockTestAccess(new Horde_Injector_TopLevel());
        $injector->TEST_ID = "PARENTINJECTOR";

        // calling create should pass a child injector to the factory
        $childInjector = $binder->create($injector);

        // now the factory should have a reference to a child injector
        $this->assertEquals($injector->TEST_ID . "->CHILD", $childInjector->TEST_ID, "Incorrect Injector passed to closure");
    }

    public function testShouldReturnBindingDetails()
    {
        $closure = function (Horde_Injector $injector) {};
        $closureBinder = new Horde_Injector_Binder_Closure(
            $closure
        );

        $this->assertEquals($closure, $closureBinder->getClosure());
    }
}

class ClosureInjectorMockTestAccess extends Horde_Injector
{
    public function createChildInjector()
    {
        $child = new self($this);
        $child->TEST_ID = $this->TEST_ID . "->CHILD";
        return $child;
    }
}