Exemplo n.º 1
0
 public function testLoadFromFile()
 {
     $a = new Model\StructureDo();
     $a->setId('chat_tienda');
     $a->loadFromFile(DIR_BASE . '/test/data/structures_demo.json');
     $this->assertEquals('chat_tienda', $a->getId());
     $this->assertEquals('Chat de tienda online', $a->getName());
     $this->assertEquals('mongodb', $a->getStorage());
     $field = $a->getFields()->get('foo');
     $this->assertEquals('foo', $field->getId());
     $this->assertEquals('pretty', $field->getName());
     $this->assertEquals('text_simple', $field->getType());
     $field = $a->getFields()->get('abierta');
     $this->assertEquals('abierta', $field->getId());
     $this->assertEquals('Abierta', $field->getName());
     $this->assertEquals('boolean', $field->getType());
     $this->setExpectedException('\\Acd\\Model\\KeyInvalidException');
     $fields = $a->getFields()->get('no_exists');
 }
Exemplo n.º 2
0
 public function testSetData()
 {
     /* Type */
     // Arrange
     $a = new Model\FieldDo();
     // Act
     $a->setId('foo');
     // Assert
     $this->assertEquals('foo', $a->getId());
     // Act
     $a->setType('text_simple');
     // Assert
     $this->assertEquals('text_simple', $a->getType());
     /* Name */
     // Arrange
     $a = new Model\StructureDo();
     // Act
     $a->setName('foo name');
     // Assert
     $this->assertEquals('foo name', $a->getName());
 }