You are here

public function AcceptHeaderItemTest::testAttribute in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php \Symfony\Component\HttpFoundation\Tests\AcceptHeaderItemTest::testAttribute()

File

vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php, line 98

Class

AcceptHeaderItemTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testAttribute() {
  $item = new AcceptHeaderItem('value', array());
  $this
    ->assertEquals(array(), $item
    ->getAttributes());
  $this
    ->assertFalse($item
    ->hasAttribute('test'));
  $this
    ->assertNull($item
    ->getAttribute('test'));
  $this
    ->assertEquals('default', $item
    ->getAttribute('test', 'default'));
  $item
    ->setAttribute('test', 'value');
  $this
    ->assertEquals(array(
    'test' => 'value',
  ), $item
    ->getAttributes());
  $this
    ->assertTrue($item
    ->hasAttribute('test'));
  $this
    ->assertEquals('value', $item
    ->getAttribute('test'));
  $this
    ->assertEquals('value', $item
    ->getAttribute('test', 'default'));
}