Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
59
vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/DisableConstructorPatchSpec.php
vendored
Normal file
59
vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/DisableConstructorPatchSpec.php
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Doubler\ClassPatch;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument;
|
||||
|
||||
class DisableConstructorPatchSpec extends ObjectBehavior
|
||||
{
|
||||
function it_is_a_patch()
|
||||
{
|
||||
$this->shouldBeAnInstanceOf('Prophecy\Doubler\ClassPatch\ClassPatchInterface');
|
||||
}
|
||||
|
||||
function its_priority_is_100()
|
||||
{
|
||||
$this->getPriority()->shouldReturn(100);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $node
|
||||
*/
|
||||
function it_supports_anything($node)
|
||||
{
|
||||
$this->supports($node)->shouldReturn(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $class
|
||||
* @param \Prophecy\Doubler\Generator\Node\MethodNode $method
|
||||
* @param \Prophecy\Doubler\Generator\Node\ArgumentNode $arg1
|
||||
* @param \Prophecy\Doubler\Generator\Node\ArgumentNode $arg2
|
||||
*/
|
||||
function it_makes_all_constructor_arguments_optional($class, $method, $arg1, $arg2)
|
||||
{
|
||||
$class->hasMethod('__construct')->willReturn(true);
|
||||
$class->getMethod('__construct')->willReturn($method);
|
||||
$method->getArguments()->willReturn(array($arg1, $arg2));
|
||||
|
||||
$arg1->setDefault(null)->shouldBeCalled();
|
||||
$arg2->setDefault(null)->shouldBeCalled();
|
||||
|
||||
$method->setCode(Argument::type('string'))->shouldBeCalled();
|
||||
|
||||
$this->apply($class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $class
|
||||
*/
|
||||
function it_creates_new_constructor_if_object_has_none($class)
|
||||
{
|
||||
$class->hasMethod('__construct')->willReturn(false);
|
||||
$class->addMethod(Argument::type('Prophecy\Doubler\Generator\Node\MethodNode'))
|
||||
->shouldBeCalled();
|
||||
|
||||
$this->apply($class);
|
||||
}
|
||||
}
|
37
vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/HhvmExceptionPatchSpec.php
vendored
Normal file
37
vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/HhvmExceptionPatchSpec.php
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Doubler\ClassPatch;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument;
|
||||
|
||||
class HhvmExceptionPatchSpec extends ObjectBehavior
|
||||
{
|
||||
function it_is_a_patch()
|
||||
{
|
||||
$this->shouldBeAnInstanceOf('Prophecy\Doubler\ClassPatch\ClassPatchInterface');
|
||||
}
|
||||
|
||||
function its_priority_is_minus_50()
|
||||
{
|
||||
$this->getPriority()->shouldReturn(-50);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $node
|
||||
* @param \Prophecy\Doubler\Generator\Node\MethodNode $method
|
||||
* @param \Prophecy\Doubler\Generator\Node\MethodNode $getterMethod
|
||||
*/
|
||||
function it_uses_parent_code_for_setTraceOptions($node, $method, $getterMethod)
|
||||
{
|
||||
$node->hasMethod('setTraceOptions')->willReturn(true);
|
||||
$node->getMethod('setTraceOptions')->willReturn($method);
|
||||
$node->hasMethod('getTraceOptions')->willReturn(true);
|
||||
$node->getMethod('getTraceOptions')->willReturn($getterMethod);
|
||||
|
||||
$method->useParentCode()->shouldBeCalled();
|
||||
$getterMethod->useParentCode()->shouldBeCalled();
|
||||
|
||||
$this->apply($node);
|
||||
}
|
||||
}
|
44
vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/KeywordPatchSpec.php
vendored
Normal file
44
vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/KeywordPatchSpec.php
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Doubler\ClassPatch;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument;
|
||||
use Prophecy\Doubler\Generator\Node\MethodNode;
|
||||
|
||||
class KeywordPatchSpec extends ObjectBehavior
|
||||
{
|
||||
function it_is_a_patch()
|
||||
{
|
||||
$this->shouldBeAnInstanceOf('Prophecy\Doubler\ClassPatch\ClassPatchInterface');
|
||||
}
|
||||
|
||||
function its_priority_is_49()
|
||||
{
|
||||
$this->getPriority()->shouldReturn(49);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $node
|
||||
* @param \Prophecy\Doubler\Generator\Node\MethodNode $method1
|
||||
* @param \Prophecy\Doubler\Generator\Node\MethodNode $method2
|
||||
* @param \Prophecy\Doubler\Generator\Node\MethodNode $method3
|
||||
*/
|
||||
function it_will_remove_echo_and_eval_methods($node, $method1, $method2, $method3)
|
||||
{
|
||||
$node->removeMethod('eval')->shouldBeCalled();
|
||||
$node->removeMethod('echo')->shouldBeCalled();
|
||||
|
||||
$method1->getName()->willReturn('echo');
|
||||
$method2->getName()->willReturn('eval');
|
||||
$method3->getName()->willReturn('notKeyword');
|
||||
|
||||
$node->getMethods()->willReturn(array(
|
||||
'echo' => $method1,
|
||||
'eval' => $method2,
|
||||
'notKeyword' => $method3,
|
||||
));
|
||||
|
||||
$this->apply($node);
|
||||
}
|
||||
}
|
76
vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/MagicCallPatchSpec.php
vendored
Normal file
76
vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/MagicCallPatchSpec.php
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Doubler\ClassPatch;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument;
|
||||
use Prophecy\Doubler\Generator\Node\MethodNode;
|
||||
|
||||
class MagicCallPatchSpec extends ObjectBehavior
|
||||
{
|
||||
function it_is_a_patch()
|
||||
{
|
||||
$this->shouldBeAnInstanceOf('Prophecy\Doubler\ClassPatch\ClassPatchInterface');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $node
|
||||
*/
|
||||
function it_supports_anything($node)
|
||||
{
|
||||
$this->supports($node)->shouldReturn(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $node
|
||||
*/
|
||||
function it_discovers_api_using_phpdoc($node)
|
||||
{
|
||||
$node->getParentClass()->willReturn('spec\Prophecy\Doubler\ClassPatch\MagicalApi');
|
||||
|
||||
$node->addMethod(new MethodNode('undefinedMethod'))->shouldBeCalled();
|
||||
|
||||
$this->apply($node);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $node
|
||||
*/
|
||||
function it_ignores_existing_methods($node)
|
||||
{
|
||||
$node->getParentClass()->willReturn('spec\Prophecy\Doubler\ClassPatch\MagicalApiExtended');
|
||||
|
||||
$node->addMethod(new MethodNode('undefinedMethod'))->shouldBeCalled();
|
||||
$node->addMethod(new MethodNode('definedMethod'))->shouldNotBeCalled();
|
||||
|
||||
$this->apply($node);
|
||||
}
|
||||
|
||||
function it_has_50_priority()
|
||||
{
|
||||
$this->getPriority()->shouldReturn(50);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @method void undefinedMethod()
|
||||
*/
|
||||
class MagicalApi
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function definedMethod()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @method void undefinedMethod()
|
||||
* @method void definedMethod()
|
||||
*/
|
||||
class MagicalApiExtended extends MagicalApi
|
||||
{
|
||||
|
||||
}
|
83
vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/ProphecySubjectPatchSpec.php
vendored
Normal file
83
vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/ProphecySubjectPatchSpec.php
vendored
Normal file
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Doubler\ClassPatch;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument;
|
||||
|
||||
class ProphecySubjectPatchSpec extends ObjectBehavior
|
||||
{
|
||||
function it_is_a_patch()
|
||||
{
|
||||
$this->shouldBeAnInstanceOf('Prophecy\Doubler\ClassPatch\ClassPatchInterface');
|
||||
}
|
||||
|
||||
function it_has_priority_of_0()
|
||||
{
|
||||
$this->getPriority()->shouldReturn(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $node
|
||||
*/
|
||||
function it_supports_any_class($node)
|
||||
{
|
||||
$this->supports($node)->shouldReturn(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $node
|
||||
*/
|
||||
function it_forces_class_to_implement_ProphecySubjectInterface($node)
|
||||
{
|
||||
$node->addInterface('Prophecy\Prophecy\ProphecySubjectInterface')->shouldBeCalled();
|
||||
|
||||
$node->addProperty('objectProphecy', 'private')->willReturn(null);
|
||||
$node->getMethods()->willReturn(array());
|
||||
$node->hasMethod(Argument::any())->willReturn(false);
|
||||
$node->addMethod(Argument::type('Prophecy\Doubler\Generator\Node\MethodNode'))->willReturn(null);
|
||||
$node->addMethod(Argument::type('Prophecy\Doubler\Generator\Node\MethodNode'))->willReturn(null);
|
||||
|
||||
$this->apply($node);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $node
|
||||
* @param \Prophecy\Doubler\Generator\Node\MethodNode $constructor
|
||||
* @param \Prophecy\Doubler\Generator\Node\MethodNode $method1
|
||||
* @param \Prophecy\Doubler\Generator\Node\MethodNode $method2
|
||||
* @param \Prophecy\Doubler\Generator\Node\MethodNode $method3
|
||||
*/
|
||||
function it_forces_all_class_methods_except_constructor_to_proxy_calls_into_prophecy_makeCall(
|
||||
$node, $constructor, $method1, $method2, $method3
|
||||
)
|
||||
{
|
||||
$node->addInterface('Prophecy\Prophecy\ProphecySubjectInterface')->willReturn(null);
|
||||
$node->addProperty('objectProphecy', 'private')->willReturn(null);
|
||||
$node->hasMethod(Argument::any())->willReturn(false);
|
||||
$node->addMethod(Argument::type('Prophecy\Doubler\Generator\Node\MethodNode'))->willReturn(null);
|
||||
$node->addMethod(Argument::type('Prophecy\Doubler\Generator\Node\MethodNode'))->willReturn(null);
|
||||
|
||||
$constructor->getName()->willReturn('__construct');
|
||||
$method1->getName()->willReturn('method1');
|
||||
$method2->getName()->willReturn('method2');
|
||||
$method3->getName()->willReturn('method3');
|
||||
|
||||
$node->getMethods()->willReturn(array(
|
||||
'method1' => $method1,
|
||||
'method2' => $method2,
|
||||
'method3' => $method3,
|
||||
));
|
||||
|
||||
$constructor->setCode(Argument::any())->shouldNotBeCalled();
|
||||
|
||||
$method1->setCode('return $this->getProphecy()->makeProphecyMethodCall(__FUNCTION__, func_get_args());')
|
||||
->shouldBeCalled();
|
||||
$method2->setCode('return $this->getProphecy()->makeProphecyMethodCall(__FUNCTION__, func_get_args());')
|
||||
->shouldBeCalled();
|
||||
$method3->setCode('return $this->getProphecy()->makeProphecyMethodCall(__FUNCTION__, func_get_args());')
|
||||
->shouldBeCalled();
|
||||
|
||||
$this->apply($node);
|
||||
}
|
||||
}
|
47
vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/ReflectionClassNewInstancePatchSpec.php
vendored
Normal file
47
vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/ReflectionClassNewInstancePatchSpec.php
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Doubler\ClassPatch;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument;
|
||||
|
||||
class ReflectionClassNewInstancePatchSpec extends ObjectBehavior
|
||||
{
|
||||
function it_is_a_patch()
|
||||
{
|
||||
$this->shouldBeAnInstanceOf('Prophecy\Doubler\ClassPatch\ClassPatchInterface');
|
||||
}
|
||||
|
||||
function its_priority_is_50()
|
||||
{
|
||||
$this->getPriority()->shouldReturn(50);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $reflectionClassNode
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $anotherClassNode
|
||||
*/
|
||||
function it_supports_ReflectionClass_only($reflectionClassNode, $anotherClassNode)
|
||||
{
|
||||
$reflectionClassNode->getParentClass()->willReturn('ReflectionClass');
|
||||
$anotherClassNode->getParentClass()->willReturn('stdClass');
|
||||
|
||||
$this->supports($reflectionClassNode)->shouldReturn(true);
|
||||
$this->supports($anotherClassNode)->shouldReturn(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $class
|
||||
* @param \Prophecy\Doubler\Generator\Node\MethodNode $method
|
||||
* @param \Prophecy\Doubler\Generator\Node\ArgumentNode $arg1
|
||||
* @param \Prophecy\Doubler\Generator\Node\ArgumentNode $arg2
|
||||
*/
|
||||
function it_makes_all_newInstance_arguments_optional($class, $method, $arg1, $arg2)
|
||||
{
|
||||
$class->getMethod('newInstance')->willReturn($method);
|
||||
$method->getArguments()->willReturn(array($arg1));
|
||||
$arg1->setDefault(null)->shouldBeCalled();
|
||||
|
||||
$this->apply($class);
|
||||
}
|
||||
}
|
91
vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/SplFileInfoPatchSpec.php
vendored
Normal file
91
vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/SplFileInfoPatchSpec.php
vendored
Normal file
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Doubler\ClassPatch;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument;
|
||||
|
||||
class SplFileInfoPatchSpec extends ObjectBehavior
|
||||
{
|
||||
function it_is_a_patch()
|
||||
{
|
||||
$this->shouldBeAnInstanceOf('Prophecy\Doubler\ClassPatch\ClassPatchInterface');
|
||||
}
|
||||
|
||||
function its_priority_is_50()
|
||||
{
|
||||
$this->getPriority()->shouldReturn(50);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $node
|
||||
*/
|
||||
function it_does_not_support_nodes_without_parent_class($node)
|
||||
{
|
||||
$node->getParentClass()->willReturn('stdClass');
|
||||
$this->supports($node)->shouldReturn(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $node
|
||||
*/
|
||||
function it_supports_nodes_with_SplFileInfo_as_parent_class($node)
|
||||
{
|
||||
$node->getParentClass()->willReturn('SplFileInfo');
|
||||
$this->supports($node)->shouldReturn(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $node
|
||||
*/
|
||||
function it_supports_nodes_with_derivative_of_SplFileInfo_as_parent_class($node)
|
||||
{
|
||||
$node->getParentClass()->willReturn('SplFileInfo');
|
||||
$this->supports($node)->shouldReturn(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $node
|
||||
*/
|
||||
function it_adds_a_method_to_node_if_not_exists($node)
|
||||
{
|
||||
$node->hasMethod('__construct')->willReturn(false);
|
||||
$node->addMethod(Argument::any())->shouldBeCalled();
|
||||
$node->getParentClass()->shouldBeCalled();
|
||||
|
||||
$this->apply($node);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $node
|
||||
* @param \Prophecy\Doubler\Generator\Node\MethodNode $method
|
||||
*/
|
||||
function it_updates_existing_method_if_found($node, $method)
|
||||
{
|
||||
$node->hasMethod('__construct')->willReturn(true);
|
||||
$node->getMethod('__construct')->willReturn($method);
|
||||
$node->getParentClass()->shouldBeCalled();
|
||||
|
||||
$method->useParentCode()->shouldBeCalled();
|
||||
|
||||
$this->apply($node);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $node
|
||||
* @param \Prophecy\Doubler\Generator\Node\MethodNode $method
|
||||
*/
|
||||
function it_should_not_supply_a_file_for_a_directory_iterator($node, $method)
|
||||
{
|
||||
$node->hasMethod('__construct')->willReturn(true);
|
||||
$node->getMethod('__construct')->willReturn($method);
|
||||
$node->getParentClass()->willReturn('DirectoryIterator');
|
||||
|
||||
$method->setCode(Argument::that(function($value) {
|
||||
return strpos($value, '.php') === false;
|
||||
}))->shouldBeCalled();
|
||||
|
||||
$this->apply($node);
|
||||
}
|
||||
|
||||
}
|
61
vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/TraversablePatchSpec.php
vendored
Normal file
61
vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/TraversablePatchSpec.php
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Doubler\ClassPatch;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument;
|
||||
|
||||
class TraversablePatchSpec extends ObjectBehavior
|
||||
{
|
||||
function it_is_a_patch()
|
||||
{
|
||||
$this->shouldBeAnInstanceOf('Prophecy\Doubler\ClassPatch\ClassPatchInterface');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $node
|
||||
*/
|
||||
function it_supports_class_that_implements_only_Traversable($node)
|
||||
{
|
||||
$node->getInterfaces()->willReturn(array('Traversable'));
|
||||
|
||||
$this->supports($node)->shouldReturn(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $node
|
||||
*/
|
||||
function it_does_not_support_class_that_implements_Iterator($node)
|
||||
{
|
||||
$node->getInterfaces()->willReturn(array('Traversable', 'Iterator'));
|
||||
|
||||
$this->supports($node)->shouldReturn(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $node
|
||||
*/
|
||||
function it_does_not_support_class_that_implements_IteratorAggregate($node)
|
||||
{
|
||||
$node->getInterfaces()->willReturn(array('Traversable', 'IteratorAggregate'));
|
||||
|
||||
$this->supports($node)->shouldReturn(false);
|
||||
}
|
||||
|
||||
function it_has_100_priority()
|
||||
{
|
||||
$this->getPriority()->shouldReturn(100);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Doubler\Generator\Node\ClassNode $node
|
||||
*/
|
||||
function it_forces_node_to_implement_IteratorAggregate($node)
|
||||
{
|
||||
$node->addInterface('Iterator')->shouldBeCalled();
|
||||
|
||||
$node->addMethod(Argument::type('Prophecy\Doubler\Generator\Node\MethodNode'))->willReturn(null);
|
||||
|
||||
$this->apply($node);
|
||||
}
|
||||
}
|
Reference in a new issue