StackFormation\Tests\ValueResolverTest::getMockedPlaceholderResolver PHP Метод

getMockedPlaceholderResolver() публичный Метод

    public function getMockedPlaceholderResolver()
    {
        $config = $this->getMock('\\StackFormation\\Config', [], [], '', false);
        $config->method('getGlobalVars')->willReturn(['GlobalFoo' => 'GlobalBar', 'GlobalFoo2' => 'GlobalBar2', 'GlobalBar' => 'GlobalFoo3', 'rescursiveA' => '{var:rescursiveB}', 'rescursiveB' => 'Hello', 'circularA' => '{var:circularB}', 'circularB' => '{var:circularA}', 'directCircular' => '{var:directCircular}', 'Dirty' => '1.2.3']);
        $stackFactoryMock = $this->getMock('\\StackFormation\\StackFactory', [], [], '', false);
        $stackFactoryMock->method('getStackOutput')->willReturnCallback(function ($stack) {
            if ($stack == 'stackthatdoesnotexist') {
                throw new \StackFormation\Exception\StackNotFoundException('stackthatdoesnotexist');
            }
            return 'dummyOutput';
        });
        $stackFactoryMock->method('getStackResource')->willReturnCallback(function ($stack) {
            if ($stack == 'stackthatdoesnotexist') {
                throw new \StackFormation\Exception\StackNotFoundException('stackthatdoesnotexist');
            }
            return 'dummyResource';
        });
        $stackFactoryMock->method('getStackParameter')->willReturnCallback(function ($stack) {
            if ($stack == 'stackthatdoesnotexist') {
                throw new \StackFormation\Exception\StackNotFoundException('stackthatdoesnotexist');
            }
            return 'dummyParameter';
        });
        $profileManagerMock = $this->getMock('\\StackFormation\\Profile\\Manager', [], [], '', false);
        $profileManagerMock->method('getStackFactory')->willReturn($stackFactoryMock);
        return new \StackFormation\ValueResolver\ValueResolver(null, $profileManagerMock, $config);
    }