api/symfony/Component/WebLink/Tests/LinkTest.yaml
2024-09-26 02:03:21 -07:00

51 lines
2.4 KiB
YAML

name: LinkTest
class_comment: '# * Test case borrowed from https://github.com/php-fig/link/.'
dependencies:
- name: TestCase
type: class
source: PHPUnit\Framework\TestCase
- name: Link
type: class
source: Symfony\Component\WebLink\Link
properties: []
methods:
- name: testTemplated
visibility: public
parameters:
- name: href
comment: "# * Test case borrowed from https://github.com/php-fig/link/.\n# */\n\
# class LinkTest extends TestCase\n# {\n# public function testCanSetAndRetrieveValues()\n\
# {\n# $link = (new Link())\n# ->withHref('http://www.google.com')\n# ->withRel('next')\n\
# ->withAttribute('me', 'you')\n# ;\n# \n# $this->assertEquals('http://www.google.com',\
\ $link->getHref());\n# $this->assertContains('next', $link->getRels());\n# $this->assertArrayHasKey('me',\
\ $link->getAttributes());\n# $this->assertEquals('you', $link->getAttributes()['me']);\n\
# }\n# \n# public function testCanRemoveValues()\n# {\n# $link = (new Link())\n\
# ->withHref('http://www.google.com')\n# ->withRel('next')\n# ->withAttribute('me',\
\ 'you')\n# ;\n# \n# $link = $link->withoutAttribute('me')\n# ->withoutRel('next');\n\
# \n# $this->assertEquals('http://www.google.com', $link->getHref());\n# $this->assertFalse(\\\
in_array('next', $link->getRels(), true));\n# $this->assertArrayNotHasKey('me',\
\ $link->getAttributes());\n# }\n# \n# public function testMultipleRels()\n# {\n\
# $link = (new Link())\n# ->withHref('http://www.google.com')\n# ->withRel('next')\n\
# ->withRel('reference');\n# \n# $this->assertCount(2, $link->getRels());\n# $this->assertContains('next',\
\ $link->getRels());\n# $this->assertContains('reference', $link->getRels());\n\
# }\n# \n# public function testConstructor()\n# {\n# $link = new Link('next',\
\ 'http://www.google.com');\n# \n# $this->assertEquals('http://www.google.com',\
\ $link->getHref());\n# $this->assertContains('next', $link->getRels());\n# }\n\
# \n# /**\n# * @dataProvider templatedHrefProvider"
- name: testNotTemplated
visibility: public
parameters:
- name: href
comment: '# * @dataProvider notTemplatedHrefProvider'
- name: templatedHrefProvider
visibility: public
parameters: []
comment: null
- name: notTemplatedHrefProvider
visibility: public
parameters: []
comment: null
traits:
- PHPUnit\Framework\TestCase
- Symfony\Component\WebLink\Link
interfaces: []