Skip to content

Commit

Permalink
par-375: Expand FieldTypeAsString enum
Browse files Browse the repository at this point in the history
  • Loading branch information
joesmith1310 committed Aug 19, 2024
1 parent 9ebac7b commit 66b7dba
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
14 changes: 13 additions & 1 deletion lib/Model/FieldTypeAsString.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ class FieldTypeAsString

const VISIBLE_TO = 'visible_to';

const INT = 'int';

const STAGE = 'stage';

const STATUS = 'status';

const VARCHAR_OPTIONS = 'varchar_options';

/**
* Gets allowable values of the enum
* @return (string|int)[]
Expand All @@ -100,7 +108,11 @@ public static function getAllowableEnumValues()
self::USER,
self::VARCHAR,
self::VARCHAR_AUTO,
self::VISIBLE_TO
self::VISIBLE_TO,
self::INT,
self::STAGE,
self::STATUS,
self::VARCHAR_OPTIONS,
];
}
}
Expand Down
32 changes: 30 additions & 2 deletions test/Deals/DealFieldsApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,41 @@
$mock->append(
new Response(200, [], json_encode([
'data' => [
[
'id' => 0,
'field_type' => 'int',
'key' => 'id',
'name' => 'ID',
'order_nr' => 0
],
[
'id' => 1,
'field_type' => 'varchar',
'key' => 'title',
'name' => 'Title',
'order_nr' => 1
],
[
'id' => 2,
'field_type' => 'status',
'key' => 'status',
'name' => 'Status',
'order_nr' => 2
],
[
'id' => 3,
'field_type' => 'stage',
'key' => 'stage_id',
'name' => 'Stage',
'order_nr' => 3
],
[
'id' => 4,
'field_type' => 'varchar_options',
'key' => 'lost_reason',
'name' => 'Lost Reason',
'order_nr' => 4
],
],
])),
);
Expand All @@ -37,5 +65,5 @@
$result = $apiInstance->getDealFields(0, 10);

expect($mock->getLastRequest()->getUri()->getQuery())->toEqual('start=0&limit=10')
->and($result->getData())->toHaveLength(1);
});
->and($result->getData())->toHaveLength(5);
});

0 comments on commit 66b7dba

Please sign in to comment.