Beispiel #1
0
 /**
  * @covers ::append
  */
 public function test_append()
 {
     # Test valid
     $Test = new ArrayObject(array('foo' => 1, 'bar' => 1, 'object' => new ArrayObject(array('foo' => 1))));
     $this->Config->append($Test);
     $this->assertEquals($Test, $this->Config[0], 'IConfig[0] should equal $Test');
     $this->Config->append(1);
     $this->assertEquals(1, $this->Config[1], 'IConfig[test] should equal 1');
     $this->Config->append('foo');
     $this->assertEquals('foo', $this->Config[2], 'IConfig[test] should equal `foo`');
     # Test invalid
     try {
         $this->Config->append(array());
         $this->fail('Unable to generate exception with invalid value');
     } catch (\UnexpectedValueException $e) {
         $this->assertContains('Instance of ArrayAccess expected', $e->getMessage(), 'Invalid exception: ' . $e->getMessage());
     }
 }