firefly-iii/tests/Objects/Field.php

68 lines
1.9 KiB
PHP
Raw Normal View History

2021-03-16 11:20:41 -05:00
<?php
2021-03-28 04:43:07 -05:00
/*
* Field.php
* Copyright (c) 2021 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
2021-03-16 11:20:41 -05:00
2021-03-28 04:43:07 -05:00
declare(strict_types=1);
2021-03-16 11:20:41 -05:00
namespace Tests\Objects;
use Closure;
/**
* Class Field
*/
class Field
{
public ?Closure $expectedReturn;
public string $expectedReturnType;
public string $fieldTitle;
public string $fieldType;
public ?array $ignorableFields;
public string $title;
2021-03-19 00:12:28 -05:00
/**
* Field constructor.
*/
public function __construct()
{
$this->expectedReturnType = 'equal'; // or 'callback'
$this->expectedReturn = null; // or the callback
$this->ignorableFields = []; // something like transactions/0/currency_code
//$optionalField->ignorableFields = ['some_field', 'transactions/0/another_field', 'rules/2/another_one',]; // something like transactions/0/currency_code
}
/**
* @param string $title
* @param string $type
*
* @return static
*/
public static function createBasic(string $title, string $type): self
{
$field = new self;
$field->title = $title;
$field->fieldTitle = $title;
$field->fieldType = $type;
return $field;
}
2021-03-28 04:43:07 -05:00
}