FieldsHelper

amocrm-php · crm, custom-fields, enum-validation, field-types, test-reference

Test reference for Fields helper managing amoCRM custom-field enums, types, and value validation

<?php

class FieldsTest extends TestCase
{
    /**
     * @var null|\AmoCRM\Helpers\Fields
     */
    private $fields = null;

    public function setUp()
    {
        $this->fields = new \AmoCRM\Helpers\Fields();

        $this->fields->add('key1', 'value1');
        $this->fields->add('key2', 'value2');
    }

    public function testAdd()
    {
        $this->fields['key3'] = 'value3';
        $this->fields->key4 = 'value4';
        $this->fields->add('key5', 'value5');
        $this->fields->offsetSet('key6', 'value6');

        $this->assertEquals(6, count($this->fields));
    }

    public function testGet()
    {
        $this->assertEquals('value1', $this->fields['key1']);
        $this->assertEquals('value1', $this->fields->key1);
        $this->assertEquals('value1', $this->fie

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key