コード例 #1
0
 public function testPropertiesManipulation()
 {
     $sUT = new Schema();
     $sUT->addProperty('test', new Property());
     $items = $sUT->getProperties();
     $this->assertSame(1, count($items));
     $sUT->addProperty('test', new Property(), true);
     $this->assertSame(1, count($sUT->getProperties()));
     $this->assertSame(1, count($sUT->getRequired()));
     $sUT->removeProperty('test');
     $this->assertSame(0, count($sUT->getProperties()));
     $this->assertSame(0, count($sUT->getRequired()));
     $sUT->addProperty('test', new Property(), true);
     $this->assertSame(1, count($sUT->getProperties()));
     $this->assertSame(1, count($sUT->getRequired()));
     $this->setExpectedException('JSONSchema\\Structure\\Exceptions\\OverwriteKeyException');
     $sUT->addProperty('test', new Property(), false, false);
 }