From 56cc4655017c06397c41b76ecaa75c292fb08eb1 Mon Sep 17 00:00:00 2001 From: Chris Kankiewicz Date: Mon, 6 Apr 2020 16:18:00 -0700 Subject: [PATCH] Standardized view functions to use underscores --- app/src/ViewFunctions/SizeForHumans.php | 2 +- app/views/components/file.twig | 2 +- tests/Factories/TwigFactoryTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/ViewFunctions/SizeForHumans.php b/app/src/ViewFunctions/SizeForHumans.php index a98cd93..24a2cdb 100644 --- a/app/src/ViewFunctions/SizeForHumans.php +++ b/app/src/ViewFunctions/SizeForHumans.php @@ -7,7 +7,7 @@ use Symfony\Component\Finder\SplFileInfo; class SizeForHumans extends ViewFunction { /** @var string The function name */ - protected $name = 'sizeForHumans'; + protected $name = 'size_for_humans'; /** * Get the human readable file size from a file object. diff --git a/app/views/components/file.twig b/app/views/components/file.twig index c30ae59..06a1bfc 100644 --- a/app/views/components/file.twig +++ b/app/views/components/file.twig @@ -31,7 +31,7 @@ {% if parentDir or file.isDir %} — {% else %} - {{ sizeForHumans(file) }} + {{ size_for_humans(file) }} {% endif %} diff --git a/tests/Factories/TwigFactoryTest.php b/tests/Factories/TwigFactoryTest.php index c49f59e..3b4e3ef 100644 --- a/tests/Factories/TwigFactoryTest.php +++ b/tests/Factories/TwigFactoryTest.php @@ -64,7 +64,7 @@ class TwigFactoryTest extends TestCase $this->assertInstanceOf( ViewFunctions\SizeForHumans::class, - $twig->getEnvironment()->getFunction('sizeForHumans')->getCallable() + $twig->getEnvironment()->getFunction('size_for_humans')->getCallable() ); $this->assertInstanceOf(