Commit 3833a99a authored by xa's avatar xa

feature(Copywritting): added a Copywritting::capitalize

parent c9cb3abc
<?php
namespace Evaneos\Helper;
class Copywritting
{
private function __construct()
{
}
public static function capitalize($var): string
{
return ucfirst(mb_strtolower((string) $var));
}
}
<?php
namespace Evaneos\Tests;
use Evaneos\Helper\Copywritting;
use PHPUnit\Framework\TestCase;
class CopywrittingTest extends TestCase
{
use \Evaneos\Tests\Assertions\AssertsUrl;
public function capitalizeObjects()
{
$obj = new class
{
public $capitalized = "Voilà";
public function __toString()
{
return "voilà";
}
};
return [
["big Bang", "Big bang"],
[42, "42"],
[$obj, $obj->capitalized],
];
}
/**
* @dataProvider capitalizeObjects
*/
public function test($input, $expected)
{
$result = Copywritting::capitalize($input);
$this->assertEquals($result, $expected);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment