Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
125
vendor/dflydev/placeholder-resolver/tests/Dflydev/PlaceholderResolver/Cache/CacheTest.php
vendored
Normal file
125
vendor/dflydev/placeholder-resolver/tests/Dflydev/PlaceholderResolver/Cache/CacheTest.php
vendored
Normal file
|
@ -0,0 +1,125 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is a part of dflydev/placeholder-resolver.
|
||||
*
|
||||
* (c) Dragonfly Development Inc.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Dflydev\PlaceholderResolver\Cache;
|
||||
|
||||
class CacheTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testSetAndGet()
|
||||
{
|
||||
$object = new CacheTestToSTring;
|
||||
|
||||
$cache = new Cache;
|
||||
$cache->set(1, "one as integer");
|
||||
$cache->set("2", "two as string '2'");
|
||||
$cache->set("three", "three as string");
|
||||
$cache->set($object, "object");
|
||||
|
||||
$this->assertEquals("one as integer", $cache->get(1));
|
||||
$this->assertEquals("two as string '2'", $cache->get('2'));
|
||||
$this->assertEquals("three as string", $cache->get('three'));
|
||||
$this->assertEquals("object", $cache->get($object));
|
||||
|
||||
$this->assertNull($cache->get(11));
|
||||
$this->assertNull($cache->get('12'));
|
||||
$this->assertNull($cache->get('thirteen'));
|
||||
}
|
||||
|
||||
public function testExists()
|
||||
{
|
||||
$object = new CacheTestToSTring;
|
||||
|
||||
$cache = new Cache;
|
||||
|
||||
$this->assertFalse($cache->exists(1));
|
||||
$this->assertFalse($cache->exists("2"));
|
||||
$this->assertFalse($cache->exists("three"));
|
||||
$this->assertFalse($cache->exists($object));
|
||||
}
|
||||
|
||||
public function testExistsArray()
|
||||
{
|
||||
$array = array();
|
||||
|
||||
$cache = new Cache;
|
||||
|
||||
$this->setExpectedException('RuntimeException');
|
||||
|
||||
$cache->exists($array);
|
||||
}
|
||||
|
||||
public function testGetArray()
|
||||
{
|
||||
$array = array();
|
||||
|
||||
$cache = new Cache;
|
||||
|
||||
$this->setExpectedException('RuntimeException');
|
||||
|
||||
$cache->get($array);
|
||||
}
|
||||
|
||||
public function testSetArray()
|
||||
{
|
||||
$array = array();
|
||||
|
||||
$cache = new Cache;
|
||||
|
||||
$this->setExpectedException('RuntimeException');
|
||||
|
||||
$cache->set($array, 'broken');
|
||||
}
|
||||
|
||||
public function testExistsNoToString()
|
||||
{
|
||||
$object = new CacheTestNoToSTring;
|
||||
|
||||
$cache = new Cache;
|
||||
|
||||
$this->setExpectedException('PHPUnit_Framework_Error');
|
||||
|
||||
$cache->exists($object);
|
||||
}
|
||||
|
||||
public function testGetNoToString()
|
||||
{
|
||||
$object = new CacheTestNoToSTring;
|
||||
|
||||
$cache = new Cache;
|
||||
|
||||
$this->setExpectedException('PHPUnit_Framework_Error');
|
||||
|
||||
$cache->get($object);
|
||||
}
|
||||
|
||||
public function testSetNoToString()
|
||||
{
|
||||
$object = new CacheTestNoToSTring;
|
||||
|
||||
$cache = new Cache;
|
||||
|
||||
$this->setExpectedException('PHPUnit_Framework_Error');
|
||||
|
||||
$cache->set($object, 'broken');
|
||||
}
|
||||
}
|
||||
|
||||
class CacheTestNoToSTring
|
||||
{
|
||||
}
|
||||
|
||||
class CacheTestToSTring
|
||||
{
|
||||
public function __toString()
|
||||
{
|
||||
return 'any string';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is a part of dflydev/placeholder-resolver.
|
||||
*
|
||||
* (c) Dragonfly Development Inc.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Dflydev\PlaceholderResolver\DataSource;
|
||||
|
||||
/**
|
||||
* ArrayDataSource Test
|
||||
*
|
||||
* @author Beau Simensen <beau@dflydev.com>
|
||||
*/
|
||||
class ArrayDataSourceTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test basic functionality
|
||||
*/
|
||||
public function testBasic()
|
||||
{
|
||||
$dataSource = new ArrayDataSource(array(
|
||||
'a' => 'A',
|
||||
'b' => 'B',
|
||||
'c' => 'C',
|
||||
));
|
||||
|
||||
$this->assertTrue($dataSource->exists('a'));
|
||||
$this->assertTrue($dataSource->exists('b'));
|
||||
$this->assertTrue($dataSource->exists('c'));
|
||||
$this->assertFalse($dataSource->exists('d'));
|
||||
|
||||
$this->assertFalse($dataSource->exists('a', true));
|
||||
$this->assertFalse($dataSource->exists('d', true));
|
||||
|
||||
$this->assertEquals('A', $dataSource->get('a'));
|
||||
$this->assertEquals('B', $dataSource->get('b'));
|
||||
$this->assertEquals('C', $dataSource->get('c'));
|
||||
$this->assertNull($dataSource->get('d'));
|
||||
|
||||
$this->assertNull($dataSource->get('a', true));
|
||||
$this->assertNull($dataSource->get('d', true));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is a part of dflydev/placeholder-resolver.
|
||||
*
|
||||
* (c) Dragonfly Development Inc.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Dflydev\PlaceholderResolver;
|
||||
|
||||
class RegexPlaceholderResolverCallbackTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testCallback()
|
||||
{
|
||||
$dataSource = $this->getMock('Dflydev\PlaceholderResolver\DataSource\DataSourceInterface');
|
||||
$dataSource
|
||||
->expects($this->any())
|
||||
->method('exists')
|
||||
->will($this->returnValueMap(array(
|
||||
array('foo', false, true),
|
||||
array('bar', false, true),
|
||||
array('baz', false, true),
|
||||
array('bat', false, false),
|
||||
array('foo', true, true),
|
||||
array('bar', true, false),
|
||||
)))
|
||||
;
|
||||
$dataSource
|
||||
->expects($this->any())
|
||||
->method('get')
|
||||
->will($this->returnValueMap(array(
|
||||
array('foo', false, 'FOO'),
|
||||
array('bar', false, 'BAR'),
|
||||
array('baz', false, 'BAZ'),
|
||||
array('foo', true, 'SYSTEM FOO'),
|
||||
)))
|
||||
;
|
||||
|
||||
$placeholderResolverCallback = new RegexPlaceholderResolverCallback($dataSource);
|
||||
|
||||
define('TEST_CONSTANT_RESOLVE', 'abc123');
|
||||
|
||||
$this->assertEquals('FOO', $placeholderResolverCallback->callback(array('${foo}', 'foo')));
|
||||
$this->assertEquals('BAR', $placeholderResolverCallback->callback(array('${bar}', 'bar')));
|
||||
$this->assertEquals('BAZ', $placeholderResolverCallback->callback(array('${baz}', 'baz')));
|
||||
$this->assertEquals('${bat}', $placeholderResolverCallback->callback(array('${bat}', 'bat')));
|
||||
$this->assertEquals('SYSTEM FOO', $placeholderResolverCallback->callback(array('${SYSTEM:foo}', 'SYSTEM:foo')));
|
||||
$this->assertEquals('${SYSTEM:bar}', $placeholderResolverCallback->callback(array('${SYSTEM:bar}', 'SYSTEM:bar')));
|
||||
$this->assertEquals('SYSTEM FOO', $placeholderResolverCallback->callback(array('${SERVER:foo}', 'SERVER:foo')));
|
||||
$this->assertEquals('${SERVER:bar}', $placeholderResolverCallback->callback(array('${SERVER:bar}', 'SERVER:bar')));
|
||||
$this->assertEquals('abc123', $placeholderResolverCallback->callback(array('${CONSTANT:TEST_CONSTANT_RESOLVE}', 'CONSTANT:TEST_CONSTANT_RESOLVE')));
|
||||
$this->assertEquals('${CONSTANT:MISSING_TEST_CONSTANT_RESOLVE}', $placeholderResolverCallback->callback(array('${CONSTANT:MISSING_TEST_CONSTANT_RESOLVE}', 'CONSTANT:MISSING_TEST_CONSTANT_RESOLVE')));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is a part of dflydev/placeholder-resolver.
|
||||
*
|
||||
* (c) Dragonfly Development Inc.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Dflydev\PlaceholderResolver;
|
||||
|
||||
class PlaceholderResolverTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testResolvePlaceholder()
|
||||
{
|
||||
$dataSource = $this->getMock('Dflydev\PlaceholderResolver\DataSource\DataSourceInterface');
|
||||
$dataSource
|
||||
->expects($this->any())
|
||||
->method('exists')
|
||||
->will($this->returnValueMap(array(
|
||||
array('foo', false, true),
|
||||
array('bar', false, true),
|
||||
array('baz', false, true),
|
||||
array('bat', false, false),
|
||||
array('composite', false, true),
|
||||
array('FOO.BAR', false, true),
|
||||
array('FOO.BAR.BAZ', false, false),
|
||||
)))
|
||||
;
|
||||
$dataSource
|
||||
->expects($this->any())
|
||||
->method('get')
|
||||
->will($this->returnValueMap(array(
|
||||
array('foo', false, 'FOO'),
|
||||
array('bar', false, 'BAR'),
|
||||
array('baz', false, 'BAZ'),
|
||||
array('composite', false, '${foo}-${bar}'),
|
||||
array('FOO.BAR', false, 'Foo Dot Bar'),
|
||||
)))
|
||||
;
|
||||
|
||||
$placeholderResolver = new RegexPlaceholderResolver($dataSource);
|
||||
|
||||
$this->assertEquals("FOO", $placeholderResolver->resolvePlaceholder('${foo}'));
|
||||
$this->assertEquals("BAR", $placeholderResolver->resolvePlaceholder('${bar}'));
|
||||
$this->assertEquals("BAZ", $placeholderResolver->resolvePlaceholder('${baz}'));
|
||||
$this->assertEquals("FOO-BAR", $placeholderResolver->resolvePlaceholder('${composite}'));
|
||||
$this->assertEquals("FOO-BAR-BAZ", $placeholderResolver->resolvePlaceholder('${composite}-${baz}'));
|
||||
$this->assertEquals("Foo Dot Bar", $placeholderResolver->resolvePlaceholder('${${foo}.${bar}}'));
|
||||
$this->assertEquals('${FOO.BAR.BAZ}', $placeholderResolver->resolvePlaceholder('${FOO.BAR.BAZ}'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider resolvePlaceholderPrefixAndSuffixProvider
|
||||
*/
|
||||
public function testResolvePlaceholderPrefixAndSuffix($prefix, $suffix)
|
||||
{
|
||||
$dataSource = $this->getMock('Dflydev\PlaceholderResolver\DataSource\DataSourceInterface');
|
||||
$dataSource
|
||||
->expects($this->any())
|
||||
->method('exists')
|
||||
->will($this->returnValueMap(array(
|
||||
array('foo', false, true),
|
||||
array('bar', false, true),
|
||||
array('baz', false, true),
|
||||
array('bat', false, false),
|
||||
array('composite', false, true),
|
||||
array('FOO.BAR', false, true),
|
||||
)))
|
||||
;
|
||||
$dataSource
|
||||
->expects($this->any())
|
||||
->method('get')
|
||||
->will($this->returnValueMap(array(
|
||||
array('foo', false, 'FOO'),
|
||||
array('bar', false, 'BAR'),
|
||||
array('baz', false, 'BAZ'),
|
||||
array('composite', false, $prefix.'foo'.$suffix.'-'.$prefix.'bar'.$suffix),
|
||||
array('FOO.BAR', false, 'Foo Dot Bar'),
|
||||
)))
|
||||
;
|
||||
|
||||
$placeholderResolver = new RegexPlaceholderResolver($dataSource, $prefix, $suffix);
|
||||
$this->assertEquals("FOO", $placeholderResolver->resolvePlaceholder($prefix.'foo'.$suffix));
|
||||
$this->assertEquals($prefix.'bat'.$suffix, $placeholderResolver->resolvePlaceholder($prefix.'bat'.$suffix));
|
||||
$this->assertEquals("FOO-BAR", $placeholderResolver->resolvePlaceholder($prefix.'composite'.$suffix));
|
||||
$this->assertEquals("FOO-BAR-BAZ", $placeholderResolver->resolvePlaceholder($prefix.'composite'.$suffix.'-'.$prefix.'baz'.$suffix));
|
||||
$this->assertEquals("Foo Dot Bar", $placeholderResolver->resolvePlaceholder($prefix.$prefix.'foo'.$suffix.'.'.$prefix.'bar'.$suffix.$suffix));
|
||||
}
|
||||
|
||||
public function resolvePlaceholderPrefixAndSuffixProvider()
|
||||
{
|
||||
return array(
|
||||
array('%', '%'),
|
||||
array('<', '>'),
|
||||
array('(<)', '(>)'),
|
||||
);
|
||||
}
|
||||
}
|
13
vendor/dflydev/placeholder-resolver/tests/bootstrap.php
vendored
Normal file
13
vendor/dflydev/placeholder-resolver/tests/bootstrap.php
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is a part of dflydev/placeholder-resolver.
|
||||
*
|
||||
* (c) Dragonfly Development Inc.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
$loader = require dirname(__DIR__).'/vendor/autoload.php';
|
||||
|
Reference in a new issue