public function testAlterSchema()
 {
     $this->endpoint->webservice()->driver()->client($this->_clientMock('get', '/custom_fields.json', [], ['custom_fields' => [['id' => 1, 'name' => 'Some boolean', 'customized_type' => 'issue', 'field_format' => 'bool', 'regexp' => '', 'default_value' => '', 'visible' => true], ['id' => 2, 'name' => 'Some integer', 'customized_type' => 'user', 'field_format' => 'int', 'regexp' => '', 'default_value' => '', 'visible' => true]]]));
     $schema = $this->endpoint->alterSchema(new Schema('issues'));
     $this->assertInstanceOf('\\CvoTechnologies\\Redmine\\Schema', $schema);
     $this->assertEquals(['type' => 'bool', 'default' => '', 'custom_field_id' => 1, 'custom_field_filterable' => null, 'length' => null, 'precision' => null, 'null' => null, 'comment' => null], $schema->column('some_boolean'));
 }
Пример #2
0
 public function schema($schema = null)
 {
     if ($schema === null) {
         if ($this->_schema === null) {
             $customFieldsEndpoint = new CustomFieldsEndpoint(['connection' => $this->connection()]);
             $this->_schema = $customFieldsEndpoint->alterSchema($this->baseSchema());
         }
         return $this->_schema;
     }
     return parent::schema($schema);
 }