<?php



namespace OpenConext\Profile\Tests\Value;

use OpenConext\Profile\Value\Logo;
use OpenConext\Profile\Value\Organization;
use PHPUnit\Framework\TestCase;

class OrganizationTest extends TestCase
{
    /**
     * @test
     * @group Organization
     * @group Value
     */
    public function getDisplayNameReturnsCorrectValue()
    {
        $displayName = ['en' => 'English displayname', 'pt' => null, 'nl' => 'Nederlandse displaynaam'];
        $name = ['en' => 'English name', 'pt' => null, 'nl' => 'Nederlandse naam'];
        $logo = new Logo(null, null, null);
        $organization = new Organization($displayName, $name, $logo);

        $this->assertEquals($organization->getDisplayName('en'), 'English displayname');
        $this->assertEquals($organization->getDisplayName('pt'), 'English name');
        $this->assertEquals($organization->getDisplayName('nl'), 'Nederlandse displaynaam');

        $displayName['nl'] = '';
        $organization2 = new Organization($displayName, $name, $logo);
        $this->assertEquals($organization2->getDisplayName('nl'), 'Nederlandse naam');

        $name['nl'] = '';
        $organization3 = new Organization($displayName, $name, $logo);
        $this->assertEquals($organization3->getDisplayName('nl'), 'English name');

        $displayName['en'] = '';
        $name['en'] = '';
        $organization4 = new Organization($displayName, $name, $logo);
        $this->assertEquals($organization4->getDisplayName('nl'), '');
    }
}
