Programming Language PHP

Namespace Oro\Component\Layout\Util

Class BlockUtils

Method/Function processUrl

Total Examples 11

11 code examples of PHP Oro\Component\Layout\Util\BlockUtils::processUrl extracted from open source projects

Was this example useful?
0
                                                    public function testProcessUrlWithPrefixAndPathAndRoute()
    {
        $view = new BlockView();
        BlockUtils::processUrl(
            $view,
            new Options([
                'test_path'             => 'http://example.com',
                'test_route_name'       => 'test_route',
                'test_route_parameters' => ['foo' => 'bar'],
            ]),
            false,
            'test'
        );

        $this->assertEquals('http://example.com', $view->vars['test_path']);
        $this->assertArrayNotHasKey('test_route_name', $view->vars);
        $this->assertArrayNotHasKey('test_route_parameters', $view->vars);
    }
                                            
Was this example useful?
0
                                                    public function testProcessUrlWithPathAndRoute()
    {
        $view = new BlockView();
        BlockUtils::processUrl(
            $view,
            new Options([
                'path'             => 'http://example.com',
                'route_name'       => 'test_route',
                'route_parameters' => ['foo' => 'bar'],
            ])
        );

        $this->assertEquals('http://example.com', $view->vars['path']);
        $this->assertArrayNotHasKey('route_name', $view->vars);
        $this->assertArrayNotHasKey('route_parameters', $view->vars);
    }
                                            
Was this example useful?
0
                                                    public function testProcessUrlWithPrefixAndRouteParameters()
    {
        $view = new BlockView();
        BlockUtils::processUrl(
            $view,
            new Options(['test_route_name' => 'test_route', 'test_route_parameters' => ['foo' => 'bar']]),
            false,
            'test'
        );

        $this->assertArrayNotHasKey('test_path', $view->vars);
        $this->assertEquals('test_route', $view->vars['test_route_name']);
        $this->assertEquals(new Options(['foo' => 'bar']), $view->vars['test_route_parameters']);
    }
                                            
Was this example useful?
0
                                                    public function testProcessUrlWithRouteParameters()
    {
        $view = new BlockView();
        BlockUtils::processUrl(
            $view,
            new Options(['route_name' => 'test_route', 'route_parameters' => ['foo' => 'bar']])
        );

        $this->assertArrayNotHasKey('path', $view->vars);
        $this->assertEquals('test_route', $view->vars['route_name']);
        $this->assertEquals(new Options(['foo' => 'bar']), $view->vars['route_parameters']);
    }
                                            
Was this example useful?
0
                                                    public function testProcessUrlWithPrefixAndRoute()
    {
        $view = new BlockView();
        BlockUtils::processUrl(
            $view,
            new Options(['test_route_name' => 'test_route']),
            false,
            'test'
        );

        $this->assertArrayNotHasKey('test_path', $view->vars);
        $this->assertEquals('test_route', $view->vars['test_route_name']);
        $this->assertEquals([], $view->vars['test_route_parameters']);
    }
                                            
Was this example useful?
0
                                                    public function testProcessUrlWithRoute()
    {
        $view = new BlockView();
        BlockUtils::processUrl(
            $view,
            new Options(['route_name' => 'test_route'])
        );

        $this->assertArrayNotHasKey('path', $view->vars);
        $this->assertEquals('test_route', $view->vars['route_name']);
        $this->assertEquals([], $view->vars['route_parameters']);
    }
                                            
Was this example useful?
0
                                                    public function testProcessUrlWithPrefixAndPath()
    {
        $view = new BlockView();
        BlockUtils::processUrl(
            $view,
            new Options(['test_path' => 'http://example.com']),
            false,
            'test'
        );

        $this->assertEquals('http://example.com', $view->vars['test_path']);
        $this->assertArrayNotHasKey('test_route_name', $view->vars);
        $this->assertArrayNotHasKey('test_route_parameters', $view->vars);
    }
                                            
Was this example useful?
0
                                                    public function testProcessUrlWithPath()
    {
        $view = new BlockView();
        BlockUtils::processUrl(
            $view,
            new Options(['path' => 'http://example.com'])
        );

        $this->assertEquals('http://example.com', $view->vars['path']);
        $this->assertArrayNotHasKey('route_name', $view->vars);
        $this->assertArrayNotHasKey('route_parameters', $view->vars);
    }
                                            
Was this example useful?
0
                                                    public function testProcessUrlWithPrefixAndEmptyOptions()
    {
        $view = new BlockView();
        BlockUtils::processUrl(
            $view,
            new Options(),
            false,
            'test'
        );

        $this->assertArrayNotHasKey('test_path', $view->vars);
        $this->assertArrayNotHasKey('test_route_name', $view->vars);
        $this->assertArrayNotHasKey('test_route_parameters', $view->vars);
    }
                                            
Was this example useful?
0
                                                    public function testProcessUrlWithEmptyOptions()
    {
        $view = new BlockView();
        BlockUtils::processUrl(
            $view,
            new Options()
        );

        $this->assertArrayNotHasKey('path', $view->vars);
        $this->assertArrayNotHasKey('route_name', $view->vars);
        $this->assertArrayNotHasKey('route_parameters', $view->vars);
    }
                                            
Was this example useful?
0
                                                    public function testProcessUrlShouldThrowExceptionIfRequiredAndEmptyOptions()
    {
        $this->expectException(\Symfony\Component\OptionsResolver\Exception\MissingOptionsException::class);
        $this->expectExceptionMessage('Either "path" or "route_name" must be set.');

        BlockUtils::processUrl(
            new BlockView(),
            new Options(),
            true
        );
    }