mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-09-15 04:15:45 +00:00
20862be7d0
- slim/slim: ^3.1 - symfony/expression-language: ^3.4 - fxp/composer-asset-plugin: ~1.3 - bower-asset/vue: ^2.5 - bower-asset/vue-resource: ^1.5
66 lines
1.6 KiB
PHP
66 lines
1.6 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the Fxp Composer Asset Plugin package.
|
|
*
|
|
* (c) François Pluchino <francois.pluchino@gmail.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Fxp\Composer\AssetPlugin\Tests\Repository\Vcs;
|
|
|
|
use Fxp\Composer\AssetPlugin\Repository\Vcs\Util;
|
|
use Fxp\Composer\AssetPlugin\Tests\Fixtures\Repository\Vcs\MockVcsDriver;
|
|
|
|
/**
|
|
* Tests of util.
|
|
*
|
|
* @author François Pluchino <francois.pluchino@gmail.com>
|
|
*/
|
|
class UtilTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
public function getDataProvider()
|
|
{
|
|
return array(
|
|
array('key'),
|
|
array('key.subkey'),
|
|
array('key.subkey.subsubkey'),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @dataProvider getDataProvider
|
|
*
|
|
* @param string $resourceKey
|
|
*/
|
|
public function testAddComposerTimeWithSimpleKey($resourceKey)
|
|
{
|
|
$composer = array(
|
|
'name' => 'test',
|
|
);
|
|
$driver = new MockVcsDriver();
|
|
|
|
$value = null;
|
|
$keys = explode('.', $resourceKey);
|
|
$start = count($keys) - 1;
|
|
|
|
for ($i = $start; $i >= 0; --$i) {
|
|
if (null === $value) {
|
|
$value = 'level '.$i;
|
|
}
|
|
|
|
$value = array($keys[$i] => $value);
|
|
}
|
|
|
|
$driver->contents = json_encode($value);
|
|
$composerValid = array_merge($composer, array(
|
|
'time' => 'level '.(count($keys) - 1),
|
|
));
|
|
|
|
$composer = Util::addComposerTime($composer, $resourceKey, 'http://example.tld', $driver);
|
|
|
|
$this->assertSame($composerValid, $composer);
|
|
}
|
|
}
|