Overview

Namespaces

  • Composer
    • Autoload
  • Guzzle
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
        • Header
      • QueryAggregator
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Mock
    • Stream
  • Mockery
    • Adapter
      • Phpunit
    • CountValidator
    • Exception
    • Generator
      • StringManipulation
        • Pass
    • Loader
    • Matcher
  • None
  • Omnipay
    • Common
      • Exception
      • Message
    • Dummy
      • Message
    • Fatzebra
      • Message
  • PHP
  • Symfony
    • Component
      • EventDispatcher
        • Debug
        • DependencyInjection
        • Tests
          • Debug
          • DependencyInjection
      • HttpFoundation
        • File
          • Exception
          • MimeType
        • Session
          • Attribute
          • Flash
          • Storage
            • Handler
            • Proxy
        • Tests
          • File
            • MimeType
          • Session
            • Attribute
            • Flash
            • Storage
              • Handler
              • Proxy
      • Yaml
        • Exception
        • Tests

Classes

  • Symfony\Component\Yaml\Tests\A
  • Symfony\Component\Yaml\Tests\B
  • Symfony\Component\Yaml\Tests\DumperTest
  • Symfony\Component\Yaml\Tests\InlineTest
  • Symfony\Component\Yaml\Tests\ParseExceptionTest
  • Symfony\Component\Yaml\Tests\ParserTest
  • Symfony\Component\Yaml\Tests\YamlTest
  • Overview
  • Namespace
  • Function
  • Tree
 1: <?php
 2: 
 3: /*
 4:  * This file is part of the Symfony package.
 5:  *
 6:  * (c) Fabien Potencier <fabien@symfony.com>
 7:  *
 8:  * For the full copyright and license information, please view the LICENSE
 9:  * file that was distributed with this source code.
10:  */
11: 
12: namespace Symfony\Component\HttpFoundation\Tests;
13: 
14: use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
15: use Symfony\Component\HttpFoundation\ExpressionRequestMatcher;
16: use Symfony\Component\HttpFoundation\Request;
17: 
18: class ExpressionRequestMatcherTest extends \PHPUnit_Framework_TestCase
19: {
20:     /**
21:      * @expectedException \LogicException
22:      */
23:     public function testWhenNoExpressionIsSet()
24:     {
25:         $expressionRequestMatcher = new ExpressionRequestMatcher();
26:         $expressionRequestMatcher->matches(new Request());
27:     }
28: 
29:     /**
30:      * @dataProvider provideExpressions
31:      */
32:     public function testMatchesWhenParentMatchesIsTrue($expression, $expected)
33:     {
34:         $request = Request::create('/foo');
35:         $expressionRequestMatcher = new ExpressionRequestMatcher();
36: 
37:         $expressionRequestMatcher->setExpression(new ExpressionLanguage(), $expression);
38:         $this->assertSame($expected, $expressionRequestMatcher->matches($request));
39:     }
40: 
41:     /**
42:      * @dataProvider provideExpressions
43:      */
44:     public function testMatchesWhenParentMatchesIsFalse($expression)
45:     {
46:         $request = Request::create('/foo');
47:         $request->attributes->set('foo', 'foo');
48:         $expressionRequestMatcher = new ExpressionRequestMatcher();
49:         $expressionRequestMatcher->matchAttribute('foo', 'bar');
50: 
51:         $expressionRequestMatcher->setExpression(new ExpressionLanguage(), $expression);
52:         $this->assertFalse($expressionRequestMatcher->matches($request));
53:     }
54: 
55:     public function provideExpressions()
56:     {
57:         return array(
58:             array('request.getMethod() == method', true),
59:             array('request.getPathInfo() == path', true),
60:             array('request.getHost() == host', true),
61:             array('request.getClientIp() == ip', true),
62:             array('request.attributes.all() == attributes', true),
63:             array('request.getMethod() == method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip &&  request.attributes.all() == attributes', true),
64:             array('request.getMethod() != method', false),
65:             array('request.getMethod() != method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip &&  request.attributes.all() == attributes', false),
66:         );
67:     }
68: }
69: 
Omnipay Fat Zebra / Paystream Gateway Module API Documentation API documentation generated by ApiGen