container);
$rgb = $provider->getBackgroundColor('Test');
$this->assertEquals(array(107, 83, 172), $rgb);
}
public function testIsActive()
{
$provider = new LetterAvatarProvider($this->container);
$this->assertTrue($provider->isActive(array()));
}
public function testRenderWithFullName()
{
$provider = new LetterAvatarProvider($this->container);
$user = array('id' => 123, 'name' => 'Kanboard Admin', 'username' => 'bob', 'email' => '');
$expected = '
KA
';
$this->assertEquals($expected, $provider->render($user, 48));
}
public function testRenderWithUsername()
{
$provider = new LetterAvatarProvider($this->container);
$user = array('id' => 123, 'name' => '', 'username' => 'admin', 'email' => '');
$expected = 'A
';
$this->assertEquals($expected, $provider->render($user, 48));
}
public function testRenderWithUTF8()
{
$provider = new LetterAvatarProvider($this->container);
$user = array('id' => 123, 'name' => 'ü', 'username' => 'admin', 'email' => '');
$expected = 'Ü
';
$this->assertEquals($expected, $provider->render($user, 48));
}
}