diff --git a/application/Espo/Core/Formula/Functions/ArrayGroup/IndexType.php b/application/Espo/Core/Formula/Functions/ArrayGroup/IndexOfType.php similarity index 98% rename from application/Espo/Core/Formula/Functions/ArrayGroup/IndexType.php rename to application/Espo/Core/Formula/Functions/ArrayGroup/IndexOfType.php index 641842d1a3..e4cbaf2f34 100644 --- a/application/Espo/Core/Formula/Functions/ArrayGroup/IndexType.php +++ b/application/Espo/Core/Formula/Functions/ArrayGroup/IndexOfType.php @@ -34,7 +34,7 @@ use Espo\Core\Formula\{ ArgumentList, }; -class IndexType extends BaseFunction +class IndexOfType extends BaseFunction { public function process(ArgumentList $args) { diff --git a/application/Espo/Resources/metadata/app/formula.json b/application/Espo/Resources/metadata/app/formula.json index d7cc3cbb64..1b50f0c608 100644 --- a/application/Espo/Resources/metadata/app/formula.json +++ b/application/Espo/Resources/metadata/app/formula.json @@ -404,8 +404,8 @@ "returnType": "string" }, { - "name": "array\\index", - "insertText": "array\\index(LIST, ELEMENT)", + "name": "array\\indexOf", + "insertText": "array\\indexOf(LIST, ELEMENT)", "returnType": "?int" }, { diff --git a/tests/unit/Espo/Core/Formula/EvaluatorTest.php b/tests/unit/Espo/Core/Formula/EvaluatorTest.php index d44039be63..bc28a109d8 100644 --- a/tests/unit/Espo/Core/Formula/EvaluatorTest.php +++ b/tests/unit/Espo/Core/Formula/EvaluatorTest.php @@ -235,45 +235,45 @@ class EvaluatorTest extends \PHPUnit\Framework\TestCase $this->assertFalse($actual); } - public function testArrayIndex1(): void + public function testArrayIndexOf1(): void { - $expression = "array\\index(list(0, 1, 2), 1)"; + $expression = "array\\indexOf(list(0, 1, 2), 1)"; $actual = $this->evaluator->process($expression); $this->assertEquals(1, $actual); } - public function testArrayIndex2(): void + public function testArrayIndexOf2(): void { - $expression = "array\\index(list('0', '1', '2'), '0')"; + $expression = "array\\indexOf(list('0', '1', '2'), '0')"; $actual = $this->evaluator->process($expression); $this->assertEquals(0, $actual); } - public function testArrayIndex3(): void + public function testArrayIndexOf3(): void { - $expression = "array\\index(list('0', '1', '2'), 1)"; + $expression = "array\\indexOf(list('0', '1', '2'), 1)"; $actual = $this->evaluator->process($expression); $this->assertEquals(null, $actual); } - public function testArrayIndex4(): void + public function testArrayIndexOf4(): void { - $expression = "array\\index(list(), 1)"; + $expression = "array\\indexOf(list(), 1)"; $actual = $this->evaluator->process($expression); $this->assertEquals(null, $actual); } - public function testArrayIndex5(): void + public function testArrayIndexOf5(): void { - $expression = "array\\index(null, 1)"; + $expression = "array\\indexOf(null, 1)"; $actual = $this->evaluator->process($expression);