68 lines
3.6 KiB
YAML
68 lines
3.6 KiB
YAML
name: UrlTest
|
|
class_comment: '# * @author Renan Taranto <renantaranto@gmail.com>'
|
|
dependencies:
|
|
- name: TestCase
|
|
type: class
|
|
source: PHPUnit\Framework\TestCase
|
|
- name: Url
|
|
type: class
|
|
source: Symfony\Component\Validator\Constraints\Url
|
|
- name: InvalidArgumentException
|
|
type: class
|
|
source: Symfony\Component\Validator\Exception\InvalidArgumentException
|
|
- name: ClassMetadata
|
|
type: class
|
|
source: Symfony\Component\Validator\Mapping\ClassMetadata
|
|
- name: AttributeLoader
|
|
type: class
|
|
source: Symfony\Component\Validator\Mapping\Loader\AttributeLoader
|
|
properties:
|
|
- name: a
|
|
visibility: private
|
|
comment: null
|
|
- name: b
|
|
visibility: private
|
|
comment: null
|
|
- name: c
|
|
visibility: private
|
|
comment: null
|
|
- name: d
|
|
visibility: private
|
|
comment: null
|
|
methods:
|
|
- name: testRequireTldDefaultsToFalse
|
|
visibility: public
|
|
parameters: []
|
|
comment: "# * @author Renan Taranto <renantaranto@gmail.com>\n# */\n# class UrlTest\
|
|
\ extends TestCase\n# {\n# public function testNormalizerCanBeSet()\n# {\n# $url\
|
|
\ = new Url(['normalizer' => 'trim', 'requireTld' => true]);\n# \n# $this->assertEquals('trim',\
|
|
\ $url->normalizer);\n# }\n# \n# public function testInvalidNormalizerThrowsException()\n\
|
|
# {\n# $this->expectException(InvalidArgumentException::class);\n# $this->expectExceptionMessage('The\
|
|
\ \"normalizer\" option must be a valid callable (\"string\" given).');\n# new\
|
|
\ Url(['normalizer' => 'Unknown Callable', 'requireTld' => true]);\n# }\n# \n\
|
|
# public function testInvalidNormalizerObjectThrowsException()\n# {\n# $this->expectException(InvalidArgumentException::class);\n\
|
|
# $this->expectExceptionMessage('The \"normalizer\" option must be a valid callable\
|
|
\ (\"stdClass\" given).');\n# new Url(['normalizer' => new \\stdClass(), 'requireTld'\
|
|
\ => true]);\n# }\n# \n# public function testAttributes()\n# {\n# $metadata =\
|
|
\ new ClassMetadata(UrlDummy::class);\n# self::assertTrue((new AttributeLoader())->loadClassMetadata($metadata));\n\
|
|
# \n# [$aConstraint] = $metadata->properties['a']->getConstraints();\n# self::assertSame(['http',\
|
|
\ 'https'], $aConstraint->protocols);\n# self::assertFalse($aConstraint->relativeProtocol);\n\
|
|
# self::assertNull($aConstraint->normalizer);\n# self::assertFalse($aConstraint->requireTld);\n\
|
|
# \n# [$bConstraint] = $metadata->properties['b']->getConstraints();\n# self::assertSame(['ftp',\
|
|
\ 'gopher'], $bConstraint->protocols);\n# self::assertSame('trim', $bConstraint->normalizer);\n\
|
|
# self::assertSame('myMessage', $bConstraint->message);\n# self::assertSame(['Default',\
|
|
\ 'UrlDummy'], $bConstraint->groups);\n# self::assertFalse($bConstraint->requireTld);\n\
|
|
# \n# [$cConstraint] = $metadata->properties['c']->getConstraints();\n# self::assertTrue($cConstraint->relativeProtocol);\n\
|
|
# self::assertSame(['my_group'], $cConstraint->groups);\n# self::assertSame('some\
|
|
\ attached data', $cConstraint->payload);\n# self::assertFalse($cConstraint->requireTld);\n\
|
|
# \n# [$dConstraint] = $metadata->properties['d']->getConstraints();\n# self::assertSame(['http',\
|
|
\ 'https'], $aConstraint->protocols);\n# self::assertFalse($aConstraint->relativeProtocol);\n\
|
|
# self::assertNull($aConstraint->normalizer);\n# self::assertTrue($dConstraint->requireTld);\n\
|
|
# }\n# \n# /**\n# * @group legacy"
|
|
traits:
|
|
- PHPUnit\Framework\TestCase
|
|
- Symfony\Component\Validator\Constraints\Url
|
|
- Symfony\Component\Validator\Exception\InvalidArgumentException
|
|
- Symfony\Component\Validator\Mapping\ClassMetadata
|
|
- Symfony\Component\Validator\Mapping\Loader\AttributeLoader
|
|
interfaces: []
|