!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache. PHP/7.3.33 

uname -a: Linux acloudg.aryanict.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC
2023 x86_64
 

uid=1095(katebhospital) gid=1098(katebhospital) groups=1098(katebhospital) 

Safe-mode: OFF (not secure)

/opt/alt/php53/usr/share/pear/test/Translation/Symfony/Component/Translation/Tests/   drwxr-xr-x
Free 293.3 GB of 429.69 GB (68.26%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     MessageCatalogueTest.php (7.78 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Translation\Tests;

use 
Symfony\Component\Translation\MessageCatalogue;

class 
MessageCatalogueTest extends \PHPUnit_Framework_TestCase
{
    public function 
testGetLocale()
    {
        
$catalogue = new MessageCatalogue('en');

        
$this->assertEquals('en'$catalogue->getLocale());
    }

    public function 
testGetDomains()
    {
        
$catalogue = new MessageCatalogue('en', array('domain1' => array(), 'domain2' => array()));

        
$this->assertEquals(array('domain1''domain2'), $catalogue->getDomains());
    }

    public function 
testAll()
    {
        
$catalogue = new MessageCatalogue('en'$messages = array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));

        
$this->assertEquals(array('foo' => 'foo'), $catalogue->all('domain1'));
        
$this->assertEquals(array(), $catalogue->all('domain88'));
        
$this->assertEquals($messages$catalogue->all());
    }

    public function 
testHas()
    {
        
$catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));

        
$this->assertTrue($catalogue->has('foo''domain1'));
        
$this->assertFalse($catalogue->has('bar''domain1'));
        
$this->assertFalse($catalogue->has('foo''domain88'));
    }

    public function 
testGetSet()
    {
        
$catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
        
$catalogue->set('foo1''foo1''domain1');

        
$this->assertEquals('foo'$catalogue->get('foo''domain1'));
        
$this->assertEquals('foo1'$catalogue->get('foo1''domain1'));
    }

    public function 
testAdd()
    {
        
$catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
        
$catalogue->add(array('foo1' => 'foo1'), 'domain1');

        
$this->assertEquals('foo'$catalogue->get('foo''domain1'));
        
$this->assertEquals('foo1'$catalogue->get('foo1''domain1'));

        
$catalogue->add(array('foo' => 'bar'), 'domain1');
        
$this->assertEquals('bar'$catalogue->get('foo''domain1'));
        
$this->assertEquals('foo1'$catalogue->get('foo1''domain1'));

        
$catalogue->add(array('foo' => 'bar'), 'domain88');
        
$this->assertEquals('bar'$catalogue->get('foo''domain88'));
    }

    public function 
testReplace()
    {
        
$catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
        
$catalogue->replace($messages = array('foo1' => 'foo1'), 'domain1');

        
$this->assertEquals($messages$catalogue->all('domain1'));
    }

    public function 
testAddCatalogue()
    {
        
$r $this->getMock('Symfony\Component\Config\Resource\ResourceInterface');
        
$r->expects($this->any())->method('__toString')->will($this->returnValue('r'));

        
$r1 $this->getMock('Symfony\Component\Config\Resource\ResourceInterface');
        
$r1->expects($this->any())->method('__toString')->will($this->returnValue('r1'));

        
$catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
        
$catalogue->addResource($r);

        
$catalogue1 = new MessageCatalogue('en', array('domain1' => array('foo1' => 'foo1')));
        
$catalogue1->addResource($r1);

        
$catalogue->addCatalogue($catalogue1);

        
$this->assertEquals('foo'$catalogue->get('foo''domain1'));
        
$this->assertEquals('foo1'$catalogue->get('foo1''domain1'));

        
$this->assertEquals(array($r$r1), $catalogue->getResources());
    }

    public function 
testAddFallbackCatalogue()
    {
        
$r $this->getMock('Symfony\Component\Config\Resource\ResourceInterface');
        
$r->expects($this->any())->method('__toString')->will($this->returnValue('r'));

        
$r1 $this->getMock('Symfony\Component\Config\Resource\ResourceInterface');
        
$r1->expects($this->any())->method('__toString')->will($this->returnValue('r1'));

        
$catalogue = new MessageCatalogue('en_US', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
        
$catalogue->addResource($r);

        
$catalogue1 = new MessageCatalogue('en', array('domain1' => array('foo' => 'bar''foo1' => 'foo1')));
        
$catalogue1->addResource($r1);

        
$catalogue->addFallbackCatalogue($catalogue1);

        
$this->assertEquals('foo'$catalogue->get('foo''domain1'));
        
$this->assertEquals('foo1'$catalogue->get('foo1''domain1'));

        
$this->assertEquals(array($r$r1), $catalogue->getResources());
    }

    
/**
     * @expectedException \LogicException
     */
    
public function testAddFallbackCatalogueWithCircularReference()
    {
        
$main = new MessageCatalogue('en_US');
        
$fallback = new MessageCatalogue('fr_FR');

        
$fallback->addFallbackCatalogue($main);
        
$main->addFallbackCatalogue($fallback);
    }

    
/**
     * @expectedException \LogicException
     */
    
public function testAddCatalogueWhenLocaleIsNotTheSameAsTheCurrentOne()
    {
        
$catalogue = new MessageCatalogue('en');
        
$catalogue->addCatalogue(new MessageCatalogue('fr', array()));
    }

    public function 
testGetAddResource()
    {
        
$catalogue = new MessageCatalogue('en');
        
$r $this->getMock('Symfony\Component\Config\Resource\ResourceInterface');
        
$r->expects($this->any())->method('__toString')->will($this->returnValue('r'));
        
$catalogue->addResource($r);
        
$catalogue->addResource($r);
        
$r1 $this->getMock('Symfony\Component\Config\Resource\ResourceInterface');
        
$r1->expects($this->any())->method('__toString')->will($this->returnValue('r1'));
        
$catalogue->addResource($r1);

        
$this->assertEquals(array($r$r1), $catalogue->getResources());
    }

    public function 
testMetadataDelete()
    {
        
$catalogue = new MessageCatalogue('en');
        
$this->assertEquals(array(), $catalogue->getMetadata(''''), 'Metadata is empty');
        
$catalogue->deleteMetadata('key''messages');
        
$catalogue->deleteMetadata('''messages');
        
$catalogue->deleteMetadata();
    }

    public function 
testMetadataSetGetDelete()
    {
        
$catalogue = new MessageCatalogue('en');
        
$catalogue->setMetadata('key''value');
        
$this->assertEquals('value'$catalogue->getMetadata('key''messages'), "Metadata 'key' = 'value'");

        
$catalogue->setMetadata('key2', array());
        
$this->assertEquals(array(), $catalogue->getMetadata('key2''messages'), 'Metadata key2 is array');

        
$catalogue->deleteMetadata('key2''messages');
        
$this->assertEquals(null$catalogue->getMetadata('key2''messages'), 'Metadata key2 should is deleted.');

        
$catalogue->deleteMetadata('key2''domain');
        
$this->assertEquals(null$catalogue->getMetadata('key2''domain'), 'Metadata key2 should is deleted.');
    }

    public function 
testMetadataMerge()
    {
        
$cat1 = new MessageCatalogue('en');
        
$cat1->setMetadata('a''b');
        
$this->assertEquals(array('messages' => array('a' => 'b')), $cat1->getMetadata(''''), 'Cat1 contains messages metadata.');

        
$cat2 = new MessageCatalogue('en');
        
$cat2->setMetadata('b''c''domain');
        
$this->assertEquals(array('domain' => array('b' => 'c')), $cat2->getMetadata(''''), 'Cat2 contains domain metadata.');

        
$cat1->addCatalogue($cat2);
        
$this->assertEquals(array('messages' => array('a' => 'b'), 'domain' => array('b' => 'c')), $cat1->getMetadata(''''), 'Cat1 contains merged metadata.');
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0051 ]--