Commit inicial con archivos existentes

This commit is contained in:
2026-01-17 16:14:00 -06:00
parent 48671dc88e
commit 4c48c279de
2539 changed files with 2412708 additions and 0 deletions

81
vendor/react/partial/tests/BindRightTest.php vendored Executable file
View File

@@ -0,0 +1,81 @@
<?php
namespace React\Partial;
class BindRightTest extends \PHPUnit_Framework_TestCase
{
public function testBindWithNoArgs()
{
$div = $this->createDivFunction();
$newDiv = bind_right($div);
$this->assertSame(2, $newDiv(4, 2));
}
public function testBindWithOneArg()
{
$div = $this->createDivFunction();
$divOne = bind_right($div, 4);
$this->assertSame(0.5, $divOne(2));
}
public function testBindWithTwoArgs()
{
$div = $this->createDivFunction();
$divTwo = bind_right($div, 2, 4);
$this->assertSame(0.5, $divTwo());
}
public function testBindWithPlaceholder()
{
$div = $this->createDivFunction();
$divFun = bind_right($div, (), 4);
$this->assertSame(5, $divFun(20));
$this->assertSame(10, $divFun(40));
}
public function testBindWithMultiplePlaceholders()
{
$div = $this->createDivFunction();
$divTwo = bind_right($div, (), 2, ());
$this->assertSame(1, $divTwo(4, 2));
$this->assertSame(1, $divTwo(10, 5));
$this->assertSame(25, $divTwo(100, 2));
}
public function testPlaceholderParameterPosition()
{
$substr = bind_right('substr', (), 0, ());
$this->assertSame('foo', $substr('foo', 3));
$this->assertSame('fo', $substr('foo', 2));
$this->assertSame('f', $substr('foo', 1));
}
/**
* @expectedException InvalidArgumentException
* @expectedExceptionMessage Cannot resolve parameter placeholder at position 0. Parameter stack is empty
*/
public function testStringConversion()
{
$div = $this->createDivFunction();
$divTwo = bind_right($div, (), 2);
$divTwo();
}
public function testAliasForUnicodePlaceholderFunction()
{
$this->assertSame((), placeholder());
}
private function createDivFunction()
{
return function () {
$args = func_get_args();
$value = array_shift($args);
foreach ($args as $arg) {
$value /= $arg;
}
return $value;
};
}
}

85
vendor/react/partial/tests/BindTest.php vendored Executable file
View File

@@ -0,0 +1,85 @@
<?php
namespace React\Partial;
class BindTest extends \PHPUnit_Framework_TestCase
{
public function testBindWithNoArgs()
{
$add = $this->createAddFunction();
$newAdd = bind($add);
$this->assertSame(6, $newAdd(1, 5));
}
public function testBindWithOneArg()
{
$add = $this->createAddFunction();
$addOne = bind($add, 1);
$this->assertSame(6, $addOne(5));
}
public function testBindWithTwoArgs()
{
$add = $this->createAddFunction();
$addOneAndFive = bind($add, 1, 5);
$this->assertSame(6, $addOneAndFive());
}
public function testBindWithPlaceholder()
{
$add = $this->createAddFunction();
$addFun = bind($add, (), 10);
$this->assertSame(20, $addFun(10));
$this->assertSame(30, $addFun(20));
}
public function testBindWithMultiplePlaceholders()
{
$prod = $this->createProdFunction();
$prodTwo = bind($prod, (), 2, ());
$this->assertSame(4, $prodTwo(1, 2));
$this->assertSame(6, $prodTwo(1, 3));
$this->assertSame(8, $prodTwo(2, 2));
$this->assertSame(24, $prodTwo(3, 4));
$this->assertSame(48, $prodTwo(3, 8));
}
public function testPlaceholderParameterPosition()
{
$substr = bind('substr', (), 0, ());
$this->assertSame('foo', $substr('foo', 3));
$this->assertSame('fo', $substr('foo', 2));
$this->assertSame('f', $substr('foo', 1));
}
/**
* @expectedException InvalidArgumentException
* @expectedExceptionMessage Cannot resolve parameter placeholder at position 0. Parameter stack is empty
*/
public function testStringConversion()
{
$add = $this->createAddFunction();
$addTwo = bind($add, (), 2);
$addTwo();
}
public function testAliasForUnicodePlaceholderFunction()
{
$this->assertSame((), placeholder());
}
private function createAddFunction()
{
return function ($a, $b) {
return $a + $b;
};
}
private function createProdFunction()
{
return function ($a, $b, $c) {
return $a * $b * $c;
};
}
}

29
vendor/react/partial/tests/UtilTest.php vendored Executable file
View File

@@ -0,0 +1,29 @@
<?php
namespace React\Partial;
use React\Partial\Util as Partial;
class UtilTest extends \PHPUnit_Framework_TestCase
{
public function testBind()
{
$div = $this->createDivFunction();
$divFun = Partial::bind($div, 10, 5);
$this->assertSame(0.02, $divFun(100));
}
public function testBindRight()
{
$div = $this->createDivFunction();
$divFun = Partial::bindRight($div, 10, 5);
$this->assertSame(2, $divFun(100));
}
private function createDivFunction()
{
return function ($a, $b, $c) {
return $a / $b / $c;
};
}
}