You are here

public function GroupSequenceTest::testLegacyArrayAccess in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Tests/Constraints/GroupSequenceTest.php \Symfony\Component\Validator\Tests\Constraints\GroupSequenceTest::testLegacyArrayAccess()

@group legacy

File

vendor/symfony/validator/Tests/Constraints/GroupSequenceTest.php, line 58

Class

GroupSequenceTest
@author Bernhard Schussek <bschussek@gmail.com>

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

public function testLegacyArrayAccess() {
  $sequence = new GroupSequence(array(
    'Group 1',
    'Group 2',
  ));
  $this
    ->assertSame('Group 1', $sequence[0]);
  $this
    ->assertSame('Group 2', $sequence[1]);
  $this
    ->assertTrue(isset($sequence[0]));
  $this
    ->assertFalse(isset($sequence[2]));
  unset($sequence[0]);
  $this
    ->assertFalse(isset($sequence[0]));
  $sequence[] = 'Group 3';
  $this
    ->assertTrue(isset($sequence[2]));
  $this
    ->assertSame('Group 3', $sequence[2]);
  $sequence[0] = 'Group 1';
  $this
    ->assertTrue(isset($sequence[0]));
  $this
    ->assertSame('Group 1', $sequence[0]);
}