Move into nested docroot
This commit is contained in:
parent
83a0d3a149
commit
c8b70abde9
13405 changed files with 0 additions and 0 deletions
146
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/ArgumentsWildcardSpec.php
vendored
Normal file
146
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/ArgumentsWildcardSpec.php
vendored
Normal file
|
@ -0,0 +1,146 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Argument;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument\Token\TokenInterface;
|
||||
|
||||
class ArgumentsWildcardSpec extends ObjectBehavior
|
||||
{
|
||||
/**
|
||||
* @param \stdClass $object
|
||||
*/
|
||||
function it_wraps_non_token_arguments_into_ExactValueToken($object)
|
||||
{
|
||||
$this->beConstructedWith(array(42, 'zet', $object));
|
||||
|
||||
$class = get_class($object->getWrappedObject());
|
||||
$hash = spl_object_hash($object->getWrappedObject());
|
||||
|
||||
$this->__toString()->shouldReturn("exact(42), exact(\"zet\"), exact($class:$hash Object (\n 'objectProphecy' => Prophecy\Prophecy\ObjectProphecy Object (*Prophecy*)\n))");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token1
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token2
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token3
|
||||
*/
|
||||
function it_generates_string_representation_from_all_tokens_imploded($token1, $token2, $token3)
|
||||
{
|
||||
$token1->__toString()->willReturn('token_1');
|
||||
$token2->__toString()->willReturn('token_2');
|
||||
$token3->__toString()->willReturn('token_3');
|
||||
|
||||
$this->beConstructedWith(array($token1, $token2, $token3));
|
||||
$this->__toString()->shouldReturn('token_1, token_2, token_3');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token
|
||||
*/
|
||||
function it_exposes_list_of_tokens($token)
|
||||
{
|
||||
$this->beConstructedWith(array($token));
|
||||
|
||||
$this->getTokens()->shouldReturn(array($token));
|
||||
}
|
||||
|
||||
function it_returns_score_of_1_if_there_are_no_tokens_and_arguments()
|
||||
{
|
||||
$this->beConstructedWith(array());
|
||||
|
||||
$this->scoreArguments(array())->shouldReturn(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token1
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token2
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token3
|
||||
*/
|
||||
function it_should_return_match_score_based_on_all_tokens_score($token1, $token2, $token3)
|
||||
{
|
||||
$token1->scoreArgument('one')->willReturn(3);
|
||||
$token1->isLast()->willReturn(false);
|
||||
$token2->scoreArgument(2)->willReturn(5);
|
||||
$token2->isLast()->willReturn(false);
|
||||
$token3->scoreArgument($obj = new \stdClass())->willReturn(10);
|
||||
$token3->isLast()->willReturn(false);
|
||||
|
||||
$this->beConstructedWith(array($token1, $token2, $token3));
|
||||
$this->scoreArguments(array('one', 2, $obj))->shouldReturn(18);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token1
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token2
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token3
|
||||
*/
|
||||
function it_returns_false_if_there_is_less_arguments_than_tokens($token1, $token2, $token3)
|
||||
{
|
||||
$token1->scoreArgument('one')->willReturn(3);
|
||||
$token1->isLast()->willReturn(false);
|
||||
$token2->scoreArgument(2)->willReturn(5);
|
||||
$token2->isLast()->willReturn(false);
|
||||
$token3->scoreArgument(null)->willReturn(false);
|
||||
$token3->isLast()->willReturn(false);
|
||||
|
||||
$this->beConstructedWith(array($token1, $token2, $token3));
|
||||
$this->scoreArguments(array('one', 2))->shouldReturn(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token1
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token2
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token3
|
||||
*/
|
||||
function it_returns_false_if_there_is_less_tokens_than_arguments($token1, $token2, $token3)
|
||||
{
|
||||
$token1->scoreArgument('one')->willReturn(3);
|
||||
$token1->isLast()->willReturn(false);
|
||||
$token2->scoreArgument(2)->willReturn(5);
|
||||
$token2->isLast()->willReturn(false);
|
||||
$token3->scoreArgument($obj = new \stdClass())->willReturn(10);
|
||||
$token3->isLast()->willReturn(false);
|
||||
|
||||
$this->beConstructedWith(array($token1, $token2, $token3));
|
||||
$this->scoreArguments(array('one', 2, $obj, 4))->shouldReturn(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token1
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token2
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token3
|
||||
*/
|
||||
function it_should_return_false_if_one_of_the_tokens_returns_false($token1, $token2, $token3)
|
||||
{
|
||||
$token1->scoreArgument('one')->willReturn(3);
|
||||
$token1->isLast()->willReturn(false);
|
||||
$token2->scoreArgument(2)->willReturn(false);
|
||||
$token2->isLast()->willReturn(false);
|
||||
$token3->scoreArgument($obj = new \stdClass())->willReturn(10);
|
||||
$token3->isLast()->willReturn(false);
|
||||
|
||||
$this->beConstructedWith(array($token1, $token2, $token3));
|
||||
$this->scoreArguments(array('one', 2, $obj))->shouldReturn(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token1
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token2
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token3
|
||||
*/
|
||||
function it_should_calculate_score_until_last_token($token1, $token2, $token3)
|
||||
{
|
||||
$token1->scoreArgument('one')->willReturn(3);
|
||||
$token1->isLast()->willReturn(false);
|
||||
|
||||
$token2->scoreArgument(2)->willReturn(7);
|
||||
$token2->isLast()->willReturn(true);
|
||||
|
||||
$token3->scoreArgument($obj = new \stdClass())->willReturn(10);
|
||||
$token3->isLast()->willReturn(false);
|
||||
|
||||
$this->beConstructedWith(array($token1, $token2, $token3));
|
||||
$this->scoreArguments(array('one', 2, $obj))->shouldReturn(10);
|
||||
}
|
||||
}
|
28
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/AnyValueTokenSpec.php
vendored
Normal file
28
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/AnyValueTokenSpec.php
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Argument\Token;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
|
||||
class AnyValueTokenSpec extends ObjectBehavior
|
||||
{
|
||||
function it_implements_TokenInterface()
|
||||
{
|
||||
$this->shouldBeAnInstanceOf('Prophecy\Argument\Token\TokenInterface');
|
||||
}
|
||||
|
||||
function it_is_not_last()
|
||||
{
|
||||
$this->shouldNotBeLast();
|
||||
}
|
||||
|
||||
function its_string_representation_is_star()
|
||||
{
|
||||
$this->__toString()->shouldReturn('*');
|
||||
}
|
||||
|
||||
function it_scores_any_argument_as_3()
|
||||
{
|
||||
$this->scoreArgument(42)->shouldReturn(3);
|
||||
}
|
||||
}
|
28
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/AnyValuesTokenSpec.php
vendored
Normal file
28
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/AnyValuesTokenSpec.php
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Argument\Token;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
|
||||
class AnyValuesTokenSpec extends ObjectBehavior
|
||||
{
|
||||
function it_implements_TokenInterface()
|
||||
{
|
||||
$this->shouldBeAnInstanceOf('Prophecy\Argument\Token\TokenInterface');
|
||||
}
|
||||
|
||||
function it_is_last()
|
||||
{
|
||||
$this->shouldBeLast();
|
||||
}
|
||||
|
||||
function its_string_representation_is_star_with_followup()
|
||||
{
|
||||
$this->__toString()->shouldReturn('* [, ...]');
|
||||
}
|
||||
|
||||
function it_scores_any_argument_as_2()
|
||||
{
|
||||
$this->scoreArgument(42)->shouldReturn(2);
|
||||
}
|
||||
}
|
64
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/ArrayCountTokenSpec.php
vendored
Normal file
64
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/ArrayCountTokenSpec.php
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Argument\Token;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
|
||||
class ArrayCountTokenSpec extends ObjectBehavior
|
||||
{
|
||||
function let()
|
||||
{
|
||||
$this->beConstructedWith(2);
|
||||
}
|
||||
|
||||
function it_implements_TokenInterface()
|
||||
{
|
||||
$this->shouldBeAnInstanceOf('Prophecy\Argument\Token\TokenInterface');
|
||||
}
|
||||
|
||||
function it_is_not_last()
|
||||
{
|
||||
$this->shouldNotBeLast();
|
||||
}
|
||||
|
||||
function it_scores_6_if_argument_array_has_proper_count()
|
||||
{
|
||||
$this->scoreArgument(array(1,2))->shouldReturn(6);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Countable $countable
|
||||
*/
|
||||
function it_scores_6_if_argument_countable_object_has_proper_count($countable)
|
||||
{
|
||||
$countable->count()->willReturn(2);
|
||||
$this->scoreArgument($countable)->shouldReturn(6);
|
||||
}
|
||||
|
||||
function it_does_not_score_if_argument_is_neither_array_nor_countable_object()
|
||||
{
|
||||
$this->scoreArgument('string')->shouldBe(false);
|
||||
$this->scoreArgument(5)->shouldBe(false);
|
||||
$this->scoreArgument(new \stdClass)->shouldBe(false);
|
||||
}
|
||||
|
||||
function it_does_not_score_if_argument_array_has_wrong_count()
|
||||
{
|
||||
$this->scoreArgument(array(1))->shouldReturn(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Countable $countable
|
||||
*/
|
||||
function it_does_not_score_if_argument_countable_object_has_wrong_count($countable)
|
||||
{
|
||||
$countable->count()->willReturn(3);
|
||||
$this->scoreArgument($countable)->shouldReturn(false);
|
||||
}
|
||||
|
||||
function it_has_simple_string_representation()
|
||||
{
|
||||
$this->__toString()->shouldBe('count(2)');
|
||||
}
|
||||
|
||||
}
|
229
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/ArrayEntryTokenSpec.php
vendored
Normal file
229
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/ArrayEntryTokenSpec.php
vendored
Normal file
|
@ -0,0 +1,229 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Argument\Token;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument;
|
||||
use Prophecy\Exception\InvalidArgumentException;
|
||||
|
||||
class ArrayEntryTokenSpec extends ObjectBehavior
|
||||
{
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $key
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $value
|
||||
*/
|
||||
function let($key, $value)
|
||||
{
|
||||
$this->beConstructedWith($key, $value);
|
||||
}
|
||||
|
||||
function it_implements_TokenInterface()
|
||||
{
|
||||
$this->shouldBeAnInstanceOf('Prophecy\Argument\Token\TokenInterface');
|
||||
}
|
||||
|
||||
function it_is_not_last()
|
||||
{
|
||||
$this->shouldNotBeLast();
|
||||
}
|
||||
|
||||
function it_holds_key_and_value($key, $value)
|
||||
{
|
||||
$this->getKey()->shouldBe($key);
|
||||
$this->getValue()->shouldBe($value);
|
||||
}
|
||||
|
||||
function its_string_representation_tells_that_its_an_array_containing_the_key_value_pair($key, $value)
|
||||
{
|
||||
$key->__toString()->willReturn('key');
|
||||
$value->__toString()->willReturn('value');
|
||||
$this->__toString()->shouldBe('[..., key => value, ...]');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $key
|
||||
* @param \stdClass $object
|
||||
*/
|
||||
function it_wraps_non_token_value_into_ExactValueToken($key, $object)
|
||||
{
|
||||
$this->beConstructedWith($key, $object);
|
||||
$this->getValue()->shouldHaveType('\Prophecy\Argument\Token\ExactValueToken');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \stdClass $object
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $value
|
||||
*/
|
||||
function it_wraps_non_token_key_into_ExactValueToken($object, $value)
|
||||
{
|
||||
$this->beConstructedWith($object, $value);
|
||||
$this->getKey()->shouldHaveType('\Prophecy\Argument\Token\ExactValueToken');
|
||||
}
|
||||
|
||||
function it_scores_array_half_of_combined_scores_from_key_and_value_tokens($key, $value)
|
||||
{
|
||||
$key->scoreArgument('key')->willReturn(4);
|
||||
$value->scoreArgument('value')->willReturn(6);
|
||||
$this->scoreArgument(array('key'=>'value'))->shouldBe(5);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $key
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $value
|
||||
* @param \Iterator $object
|
||||
*/
|
||||
function it_scores_traversable_object_half_of_combined_scores_from_key_and_value_tokens($key, $value, $object)
|
||||
{
|
||||
$object->current()->will(function () use ($object) {
|
||||
$object->valid()->willReturn(false);
|
||||
|
||||
return 'value';
|
||||
});
|
||||
$object->key()->willReturn('key');
|
||||
$object->rewind()->willReturn(null);
|
||||
$object->next()->willReturn(null);
|
||||
$object->valid()->willReturn(true);
|
||||
$key->scoreArgument('key')->willReturn(6);
|
||||
$value->scoreArgument('value')->willReturn(2);
|
||||
$this->scoreArgument($object)->shouldBe(4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\AnyValuesToken $key
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $value
|
||||
* @param \ArrayAccess $object
|
||||
*/
|
||||
function it_throws_exception_during_scoring_of_array_accessible_object_if_key_is_not_ExactValueToken($key, $value, $object)
|
||||
{
|
||||
$key->__toString()->willReturn('any_token');
|
||||
$this->beConstructedWith($key,$value);
|
||||
$errorMessage = 'You can only use exact value tokens to match key of ArrayAccess object'.PHP_EOL.
|
||||
'But you used `any_token`.';
|
||||
$this->shouldThrow(new InvalidArgumentException($errorMessage))->duringScoreArgument($object);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\ExactValueToken $key
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $value
|
||||
* @param \ArrayAccess $object
|
||||
*/
|
||||
function it_scores_array_accessible_object_half_of_combined_scores_from_key_and_value_tokens($key, $value, $object)
|
||||
{
|
||||
$object->offsetExists('key')->willReturn(true);
|
||||
$object->offsetGet('key')->willReturn('value');
|
||||
$key->getValue()->willReturn('key');
|
||||
$key->scoreArgument('key')->willReturn(3);
|
||||
$value->scoreArgument('value')->willReturn(1);
|
||||
$this->scoreArgument($object)->shouldBe(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\AnyValuesToken $key
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $value
|
||||
* @param \ArrayIterator $object
|
||||
*/
|
||||
function it_accepts_any_key_token_type_to_score_object_that_is_both_traversable_and_array_accessible($key, $value, $object)
|
||||
{
|
||||
$this->beConstructedWith($key, $value);
|
||||
$object->current()->will(function () use ($object) {
|
||||
$object->valid()->willReturn(false);
|
||||
|
||||
return 'value';
|
||||
});
|
||||
$object->key()->willReturn('key');
|
||||
$object->rewind()->willReturn(null);
|
||||
$object->next()->willReturn(null);
|
||||
$object->valid()->willReturn(true);
|
||||
$this->shouldNotThrow(new InvalidArgumentException)->duringScoreArgument($object);
|
||||
}
|
||||
|
||||
function it_does_not_score_if_argument_is_neither_array_nor_traversable_nor_array_accessible()
|
||||
{
|
||||
$this->scoreArgument('string')->shouldBe(false);
|
||||
$this->scoreArgument(new \stdClass)->shouldBe(false);
|
||||
}
|
||||
|
||||
function it_does_not_score_empty_array()
|
||||
{
|
||||
$this->scoreArgument(array())->shouldBe(false);
|
||||
}
|
||||
|
||||
function it_does_not_score_array_if_key_and_value_tokens_do_not_score_same_entry($key, $value)
|
||||
{
|
||||
$argument = array(1 => 'foo', 2 => 'bar');
|
||||
$key->scoreArgument(1)->willReturn(true);
|
||||
$key->scoreArgument(2)->willReturn(false);
|
||||
$value->scoreArgument('foo')->willReturn(false);
|
||||
$value->scoreArgument('bar')->willReturn(true);
|
||||
$this->scoreArgument($argument)->shouldBe(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Iterator $object
|
||||
*/
|
||||
function it_does_not_score_traversable_object_without_entries($object)
|
||||
{
|
||||
$object->rewind()->willReturn(null);
|
||||
$object->next()->willReturn(null);
|
||||
$object->valid()->willReturn(false);
|
||||
$this->scoreArgument($object)->shouldBe(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $key
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $value
|
||||
* @param \Iterator $object
|
||||
*/
|
||||
function it_does_not_score_traversable_object_if_key_and_value_tokens_do_not_score_same_entry($key, $value, $object)
|
||||
{
|
||||
$object->current()->willReturn('foo');
|
||||
$object->current()->will(function () use ($object) {
|
||||
$object->valid()->willReturn(false);
|
||||
|
||||
return 'bar';
|
||||
});
|
||||
$object->key()->willReturn(1);
|
||||
$object->key()->willReturn(2);
|
||||
$object->rewind()->willReturn(null);
|
||||
$object->next()->willReturn(null);
|
||||
$object->valid()->willReturn(true);
|
||||
$key->scoreArgument(1)->willReturn(true);
|
||||
$key->scoreArgument(2)->willReturn(false);
|
||||
$value->scoreArgument('foo')->willReturn(false);
|
||||
$value->scoreArgument('bar')->willReturn(true);
|
||||
$this->scoreArgument($object)->shouldBe(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\ExactValueToken $key
|
||||
* @param \ArrayAccess $object
|
||||
*/
|
||||
function it_does_not_score_array_accessible_object_if_it_has_no_offset_with_key_token_value($key, $object)
|
||||
{
|
||||
$object->offsetExists('key')->willReturn(false);
|
||||
$key->getValue()->willReturn('key');
|
||||
$this->scoreArgument($object)->shouldBe(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\ExactValueToken $key
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $value
|
||||
* @param \ArrayAccess $object
|
||||
*/
|
||||
function it_does_not_score_array_accessible_object_if_key_and_value_tokens_do_not_score_same_entry($key, $value, $object)
|
||||
{
|
||||
$object->offsetExists('key')->willReturn(true);
|
||||
$object->offsetGet('key')->willReturn('value');
|
||||
$key->getValue()->willReturn('key');
|
||||
$value->scoreArgument('value')->willReturn(false);
|
||||
$key->scoreArgument('key')->willReturn(true);
|
||||
$this->scoreArgument($object)->shouldBe(false);
|
||||
}
|
||||
|
||||
function its_score_is_capped_at_8($key, $value)
|
||||
{
|
||||
$key->scoreArgument('key')->willReturn(10);
|
||||
$value->scoreArgument('value')->willReturn(10);
|
||||
$this->scoreArgument(array('key'=>'value'))->shouldBe(8);
|
||||
}
|
||||
}
|
109
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/ArrayEveryEntryTokenSpec.php
vendored
Normal file
109
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/ArrayEveryEntryTokenSpec.php
vendored
Normal file
|
@ -0,0 +1,109 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Argument\Token;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument;
|
||||
|
||||
class ArrayEveryEntryTokenSpec extends ObjectBehavior
|
||||
{
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $value
|
||||
*/
|
||||
function let($value)
|
||||
{
|
||||
$this->beConstructedWith($value);
|
||||
}
|
||||
|
||||
function it_implements_TokenInterface()
|
||||
{
|
||||
$this->shouldBeAnInstanceOf('Prophecy\Argument\Token\TokenInterface');
|
||||
}
|
||||
|
||||
function it_is_not_last()
|
||||
{
|
||||
$this->shouldNotBeLast();
|
||||
}
|
||||
|
||||
function it_holds_value($value)
|
||||
{
|
||||
$this->getValue()->shouldBe($value);
|
||||
}
|
||||
|
||||
function its_string_representation_tells_that_its_an_array_containing_only_value($value)
|
||||
{
|
||||
$value->__toString()->willReturn('value');
|
||||
$this->__toString()->shouldBe('[value, ..., value]');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \stdClass $stdClass
|
||||
*/
|
||||
function it_wraps_non_token_value_into_ExactValueToken($stdClass)
|
||||
{
|
||||
$this->beConstructedWith($stdClass);
|
||||
$this->getValue()->shouldHaveType('Prophecy\Argument\Token\ExactValueToken');
|
||||
}
|
||||
|
||||
function it_does_not_score_if_argument_is_neither_array_nor_traversable()
|
||||
{
|
||||
$this->scoreArgument('string')->shouldBe(false);
|
||||
$this->scoreArgument(new \stdClass)->shouldBe(false);
|
||||
}
|
||||
|
||||
function it_does_not_score_empty_array()
|
||||
{
|
||||
$this->scoreArgument(array())->shouldBe(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Iterator $object
|
||||
*/
|
||||
function it_does_not_score_traversable_object_without_entries($object)
|
||||
{
|
||||
$object->rewind()->willReturn(null);
|
||||
$object->next()->willReturn(null);
|
||||
$object->valid()->willReturn(false);
|
||||
$this->scoreArgument($object)->shouldBe(false);
|
||||
}
|
||||
|
||||
function it_scores_avg_of_scores_from_value_tokens($value)
|
||||
{
|
||||
$value->scoreArgument('value1')->willReturn(6);
|
||||
$value->scoreArgument('value2')->willReturn(3);
|
||||
$this->scoreArgument(array('value1', 'value2'))->shouldBe(4.5);
|
||||
}
|
||||
|
||||
function it_scores_false_if_entry_scores_false($value)
|
||||
{
|
||||
$value->scoreArgument('value1')->willReturn(6);
|
||||
$value->scoreArgument('value2')->willReturn(false);
|
||||
$this->scoreArgument(array('value1', 'value2'))->shouldBe(false);
|
||||
}
|
||||
|
||||
function it_does_not_score_array_keys($value)
|
||||
{
|
||||
$value->scoreArgument('value')->willReturn(6);
|
||||
$value->scoreArgument('key')->shouldNotBeCalled(0);
|
||||
$this->scoreArgument(array('key' => 'value'))->shouldBe(6);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $value
|
||||
* @param \Iterator $object
|
||||
*/
|
||||
function it_scores_traversable_object_from_value_token($value, $object)
|
||||
{
|
||||
$object->current()->will(function ($args, $object) {
|
||||
$object->valid()->willReturn(false);
|
||||
|
||||
return 'value';
|
||||
});
|
||||
$object->key()->willReturn('key');
|
||||
$object->rewind()->willReturn(null);
|
||||
$object->next()->willReturn(null);
|
||||
$object->valid()->willReturn(true);
|
||||
$value->scoreArgument('value')->willReturn(2);
|
||||
$this->scoreArgument($object)->shouldBe(2);
|
||||
}
|
||||
}
|
42
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/CallbackTokenSpec.php
vendored
Normal file
42
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/CallbackTokenSpec.php
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Argument\Token;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
|
||||
class CallbackTokenSpec extends ObjectBehavior
|
||||
{
|
||||
function let()
|
||||
{
|
||||
$this->beConstructedWith('get_class');
|
||||
}
|
||||
|
||||
function it_implements_TokenInterface()
|
||||
{
|
||||
$this->shouldBeAnInstanceOf('Prophecy\Argument\Token\TokenInterface');
|
||||
}
|
||||
|
||||
function it_is_not_last()
|
||||
{
|
||||
$this->shouldNotBeLast();
|
||||
}
|
||||
|
||||
function it_scores_7_if_argument_matches_callback()
|
||||
{
|
||||
$this->beConstructedWith(function ($argument) { return 2 === $argument; });
|
||||
|
||||
$this->scoreArgument(2)->shouldReturn(7);
|
||||
}
|
||||
|
||||
function it_does_not_scores_if_argument_does_not_match_callback()
|
||||
{
|
||||
$this->beConstructedWith(function ($argument) { return 2 === $argument; });
|
||||
|
||||
$this->scoreArgument(5)->shouldReturn(false);
|
||||
}
|
||||
|
||||
function its_string_representation_should_tell_that_its_callback()
|
||||
{
|
||||
$this->__toString()->shouldReturn('callback()');
|
||||
}
|
||||
}
|
155
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/ExactValueTokenSpec.php
vendored
Normal file
155
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/ExactValueTokenSpec.php
vendored
Normal file
|
@ -0,0 +1,155 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Argument\Token;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
|
||||
class ExactValueTokenSpec extends ObjectBehavior
|
||||
{
|
||||
function let()
|
||||
{
|
||||
$this->beConstructedWith(42);
|
||||
}
|
||||
|
||||
function it_implements_TokenInterface()
|
||||
{
|
||||
$this->shouldBeAnInstanceOf('Prophecy\Argument\Token\TokenInterface');
|
||||
}
|
||||
|
||||
function it_is_not_last()
|
||||
{
|
||||
$this->shouldNotBeLast();
|
||||
}
|
||||
|
||||
function it_holds_value()
|
||||
{
|
||||
$this->getValue()->shouldReturn(42);
|
||||
}
|
||||
|
||||
function it_scores_10_if_value_is_equal_to_argument()
|
||||
{
|
||||
$this->scoreArgument(42)->shouldReturn(10);
|
||||
$this->scoreArgument('42')->shouldReturn(10);
|
||||
}
|
||||
|
||||
function it_scores_10_if_value_is_an_object_and_equal_to_argument()
|
||||
{
|
||||
$value = new \DateTime();
|
||||
$value2 = clone $value;
|
||||
|
||||
$this->beConstructedWith($value);
|
||||
$this->scoreArgument($value2)->shouldReturn(10);
|
||||
}
|
||||
|
||||
function it_does_not_scores_if_value_is_not_equal_to_argument()
|
||||
{
|
||||
$this->scoreArgument(50)->shouldReturn(false);
|
||||
$this->scoreArgument(new \stdClass())->shouldReturn(false);
|
||||
}
|
||||
|
||||
function it_does_not_scores_if_value_an_object_and_is_not_equal_to_argument()
|
||||
{
|
||||
$value = new ExactValueTokenFixtureB('ABC');
|
||||
$value2 = new ExactValueTokenFixtureB('CBA');
|
||||
|
||||
$this->beConstructedWith($value);
|
||||
$this->scoreArgument($value2)->shouldReturn(false);
|
||||
}
|
||||
|
||||
function it_does_not_scores_if_value_type_and_is_not_equal_to_argument()
|
||||
{
|
||||
$this->beConstructedWith(false);
|
||||
$this->scoreArgument(0)->shouldReturn(false);
|
||||
}
|
||||
|
||||
function it_generates_proper_string_representation_for_integer()
|
||||
{
|
||||
$this->beConstructedWith(42);
|
||||
$this->__toString()->shouldReturn('exact(42)');
|
||||
}
|
||||
|
||||
function it_generates_proper_string_representation_for_string()
|
||||
{
|
||||
$this->beConstructedWith('some string');
|
||||
$this->__toString()->shouldReturn('exact("some string")');
|
||||
}
|
||||
|
||||
function it_generates_single_line_representation_for_multiline_string()
|
||||
{
|
||||
$this->beConstructedWith("some\nstring");
|
||||
$this->__toString()->shouldReturn('exact("some\\nstring")');
|
||||
}
|
||||
|
||||
function it_generates_proper_string_representation_for_double()
|
||||
{
|
||||
$this->beConstructedWith(42.3);
|
||||
$this->__toString()->shouldReturn('exact(42.3)');
|
||||
}
|
||||
|
||||
function it_generates_proper_string_representation_for_boolean_true()
|
||||
{
|
||||
$this->beConstructedWith(true);
|
||||
$this->__toString()->shouldReturn('exact(true)');
|
||||
}
|
||||
|
||||
function it_generates_proper_string_representation_for_boolean_false()
|
||||
{
|
||||
$this->beConstructedWith(false);
|
||||
$this->__toString()->shouldReturn('exact(false)');
|
||||
}
|
||||
|
||||
function it_generates_proper_string_representation_for_null()
|
||||
{
|
||||
$this->beConstructedWith(null);
|
||||
$this->__toString()->shouldReturn('exact(null)');
|
||||
}
|
||||
|
||||
function it_generates_proper_string_representation_for_empty_array()
|
||||
{
|
||||
$this->beConstructedWith(array());
|
||||
$this->__toString()->shouldReturn('exact([])');
|
||||
}
|
||||
|
||||
function it_generates_proper_string_representation_for_array()
|
||||
{
|
||||
$this->beConstructedWith(array('zet', 42));
|
||||
$this->__toString()->shouldReturn('exact(["zet", 42])');
|
||||
}
|
||||
|
||||
function it_generates_proper_string_representation_for_resource()
|
||||
{
|
||||
$resource = fopen(__FILE__, 'r');
|
||||
$this->beConstructedWith($resource);
|
||||
$this->__toString()->shouldReturn('exact(stream:'.$resource.')');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \stdClass $object
|
||||
*/
|
||||
function it_generates_proper_string_representation_for_object($object)
|
||||
{
|
||||
$objHash = sprintf('%s:%s',
|
||||
get_class($object->getWrappedObject()),
|
||||
spl_object_hash($object->getWrappedObject())
|
||||
);
|
||||
|
||||
$this->beConstructedWith($object);
|
||||
$this->__toString()->shouldReturn("exact($objHash Object (\n 'objectProphecy' => Prophecy\Prophecy\ObjectProphecy Object (*Prophecy*)\n))");
|
||||
}
|
||||
}
|
||||
|
||||
class ExactValueTokenFixtureA
|
||||
{
|
||||
public $errors;
|
||||
}
|
||||
|
||||
class ExactValueTokenFixtureB extends ExactValueTokenFixtureA
|
||||
{
|
||||
public $errors;
|
||||
public $value = null;
|
||||
|
||||
public function __construct($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
152
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/IdenticalValueTokenSpec.php
vendored
Normal file
152
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/IdenticalValueTokenSpec.php
vendored
Normal file
|
@ -0,0 +1,152 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Argument\Token;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument;
|
||||
|
||||
class IdenticalValueTokenSpec extends ObjectBehavior
|
||||
{
|
||||
function let()
|
||||
{
|
||||
$this->beConstructedWith(42);
|
||||
}
|
||||
|
||||
function it_is_initializable()
|
||||
{
|
||||
$this->shouldHaveType('Prophecy\Argument\Token\IdenticalValueToken');
|
||||
}
|
||||
|
||||
function it_scores_11_if_string_value_is_identical_to_argument()
|
||||
{
|
||||
$this->beConstructedWith('foo');
|
||||
$this->scoreArgument('foo')->shouldReturn(11);
|
||||
}
|
||||
|
||||
function it_scores_11_if_boolean_value_is_identical_to_argument()
|
||||
{
|
||||
$this->beConstructedWith(false);
|
||||
$this->scoreArgument(false)->shouldReturn(11);
|
||||
}
|
||||
|
||||
function it_scores_11_if_integer_value_is_identical_to_argument()
|
||||
{
|
||||
$this->beConstructedWith(31);
|
||||
$this->scoreArgument(31)->shouldReturn(11);
|
||||
}
|
||||
|
||||
function it_scores_11_if_float_value_is_identical_to_argument()
|
||||
{
|
||||
$this->beConstructedWith(31.12);
|
||||
$this->scoreArgument(31.12)->shouldReturn(11);
|
||||
}
|
||||
|
||||
function it_scores_11_if_array_value_is_identical_to_argument()
|
||||
{
|
||||
$this->beConstructedWith(array('foo' => 'bar'));
|
||||
$this->scoreArgument(array('foo' => 'bar'))->shouldReturn(11);
|
||||
}
|
||||
|
||||
function it_scores_11_if_object_value_is_identical_to_argument()
|
||||
{
|
||||
$object = new \stdClass();
|
||||
|
||||
$this->beConstructedWith($object);
|
||||
$this->scoreArgument($object)->shouldReturn(11);
|
||||
}
|
||||
|
||||
function it_scores_false_if_value_is_not_identical_to_argument()
|
||||
{
|
||||
$this->beConstructedWith(new \stdClass());
|
||||
$this->scoreArgument('foo')->shouldReturn(false);
|
||||
}
|
||||
|
||||
function it_scores_false_if_object_value_is_not_the_same_instance_than_argument()
|
||||
{
|
||||
$this->beConstructedWith(new \stdClass());
|
||||
$this->scoreArgument(new \stdClass())->shouldReturn(false);
|
||||
}
|
||||
|
||||
function it_scores_false_if_integer_value_is_not_identical_to_boolean_argument()
|
||||
{
|
||||
$this->beConstructedWith(1);
|
||||
$this->scoreArgument(true)->shouldReturn(false);
|
||||
}
|
||||
|
||||
function it_is_not_last()
|
||||
{
|
||||
$this->shouldNotBeLast();
|
||||
}
|
||||
|
||||
function it_generates_proper_string_representation_for_integer()
|
||||
{
|
||||
$this->beConstructedWith(42);
|
||||
$this->__toString()->shouldReturn('identical(42)');
|
||||
}
|
||||
|
||||
function it_generates_proper_string_representation_for_string()
|
||||
{
|
||||
$this->beConstructedWith('some string');
|
||||
$this->__toString()->shouldReturn('identical("some string")');
|
||||
}
|
||||
|
||||
function it_generates_single_line_representation_for_multiline_string()
|
||||
{
|
||||
$this->beConstructedWith("some\nstring");
|
||||
$this->__toString()->shouldReturn('identical("some\\nstring")');
|
||||
}
|
||||
|
||||
function it_generates_proper_string_representation_for_double()
|
||||
{
|
||||
$this->beConstructedWith(42.3);
|
||||
$this->__toString()->shouldReturn('identical(42.3)');
|
||||
}
|
||||
|
||||
function it_generates_proper_string_representation_for_boolean_true()
|
||||
{
|
||||
$this->beConstructedWith(true);
|
||||
$this->__toString()->shouldReturn('identical(true)');
|
||||
}
|
||||
|
||||
function it_generates_proper_string_representation_for_boolean_false()
|
||||
{
|
||||
$this->beConstructedWith(false);
|
||||
$this->__toString()->shouldReturn('identical(false)');
|
||||
}
|
||||
|
||||
function it_generates_proper_string_representation_for_null()
|
||||
{
|
||||
$this->beConstructedWith(null);
|
||||
$this->__toString()->shouldReturn('identical(null)');
|
||||
}
|
||||
|
||||
function it_generates_proper_string_representation_for_empty_array()
|
||||
{
|
||||
$this->beConstructedWith(array());
|
||||
$this->__toString()->shouldReturn('identical([])');
|
||||
}
|
||||
|
||||
function it_generates_proper_string_representation_for_array()
|
||||
{
|
||||
$this->beConstructedWith(array('zet', 42));
|
||||
$this->__toString()->shouldReturn('identical(["zet", 42])');
|
||||
}
|
||||
|
||||
function it_generates_proper_string_representation_for_resource()
|
||||
{
|
||||
$resource = fopen(__FILE__, 'r');
|
||||
$this->beConstructedWith($resource);
|
||||
$this->__toString()->shouldReturn('identical(stream:'.$resource.')');
|
||||
}
|
||||
|
||||
function it_generates_proper_string_representation_for_object($object)
|
||||
{
|
||||
$objHash = sprintf('%s:%s',
|
||||
get_class($object->getWrappedObject()),
|
||||
spl_object_hash($object->getWrappedObject())
|
||||
);
|
||||
|
||||
$this->beConstructedWith($object);
|
||||
$this->__toString()->shouldReturn("identical($objHash Object (\n 'objectProphecy' => Prophecy\Prophecy\ObjectProphecy Object (*Prophecy*)\n))");
|
||||
}
|
||||
}
|
78
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/LogicalAndTokenSpec.php
vendored
Normal file
78
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/LogicalAndTokenSpec.php
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Argument\Token;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument;
|
||||
|
||||
class LogicalAndTokenSpec extends ObjectBehavior
|
||||
{
|
||||
function it_implements_TokenInterface()
|
||||
{
|
||||
$this->beConstructedWith(array());
|
||||
$this->shouldBeAnInstanceOf('Prophecy\Argument\Token\TokenInterface');
|
||||
}
|
||||
|
||||
function it_is_not_last()
|
||||
{
|
||||
$this->beConstructedWith(array());
|
||||
$this->shouldNotBeLast();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token1
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token2
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token3
|
||||
*/
|
||||
function it_generates_string_representation_from_all_tokens_imploded($token1, $token2, $token3)
|
||||
{
|
||||
$token1->__toString()->willReturn('token_1');
|
||||
$token2->__toString()->willReturn('token_2');
|
||||
$token3->__toString()->willReturn('token_3');
|
||||
|
||||
$this->beConstructedWith(array($token1, $token2, $token3));
|
||||
$this->__toString()->shouldReturn('bool(token_1 AND token_2 AND token_3)');
|
||||
}
|
||||
|
||||
function it_wraps_non_token_arguments_into_ExactValueToken()
|
||||
{
|
||||
$this->beConstructedWith(array(15, '1985'));
|
||||
$this->__toString()->shouldReturn("bool(exact(15) AND exact(\"1985\"))");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token1
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token2
|
||||
*/
|
||||
function it_scores_the_maximum_score_from_all_scores_returned_by_tokens($token1, $token2)
|
||||
{
|
||||
$token1->scoreArgument(1)->willReturn(10);
|
||||
$token2->scoreArgument(1)->willReturn(5);
|
||||
$this->beConstructedWith(array($token1, $token2));
|
||||
$this->scoreArgument(1)->shouldReturn(10);
|
||||
}
|
||||
|
||||
function it_does_not_score_if_there_are_no_arguments_or_tokens()
|
||||
{
|
||||
$this->beConstructedWith(array());
|
||||
$this->scoreArgument('any')->shouldReturn(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token1
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token2
|
||||
*/
|
||||
function it_does_not_score_if_either_of_tokens_does_not_score($token1, $token2)
|
||||
{
|
||||
$token1->scoreArgument(1)->willReturn(10);
|
||||
$token1->scoreArgument(2)->willReturn(false);
|
||||
|
||||
$token2->scoreArgument(1)->willReturn(false);
|
||||
$token2->scoreArgument(2)->willReturn(10);
|
||||
|
||||
$this->beConstructedWith(array($token1, $token2));
|
||||
|
||||
$this->scoreArgument(1)->shouldReturn(false);
|
||||
$this->scoreArgument(2)->shouldReturn(false);
|
||||
}
|
||||
}
|
65
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/LogicalNotTokenSpec.php
vendored
Normal file
65
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/LogicalNotTokenSpec.php
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Argument\Token;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument\Token\TokenInterface;
|
||||
|
||||
class LogicalNotTokenSpec extends ObjectBehavior
|
||||
{
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $token
|
||||
*/
|
||||
function let($token)
|
||||
{
|
||||
$this->beConstructedWith($token);
|
||||
}
|
||||
|
||||
function it_implements_TokenInterface()
|
||||
{
|
||||
$this->shouldBeAnInstanceOf('Prophecy\Argument\Token\TokenInterface');
|
||||
}
|
||||
|
||||
function it_holds_originating_token($token)
|
||||
{
|
||||
$this->getOriginatingToken()->shouldReturn($token);
|
||||
}
|
||||
|
||||
function it_has_simple_string_representation($token)
|
||||
{
|
||||
$token->__toString()->willReturn('value');
|
||||
$this->__toString()->shouldBe('not(value)');
|
||||
}
|
||||
|
||||
function it_wraps_non_token_argument_into_ExactValueToken()
|
||||
{
|
||||
$this->beConstructedWith(5);
|
||||
$token = $this->getOriginatingToken();
|
||||
$token->shouldhaveType('Prophecy\Argument\Token\ExactValueToken');
|
||||
$token->getValue()->shouldBe(5);
|
||||
}
|
||||
|
||||
function it_scores_4_if_preset_token_does_not_match_the_argument($token)
|
||||
{
|
||||
$token->scoreArgument('argument')->willReturn(false);
|
||||
$this->scoreArgument('argument')->shouldBe(4);
|
||||
}
|
||||
|
||||
function it_does_not_score_if_preset_token_matches_argument($token)
|
||||
{
|
||||
$token->scoreArgument('argument')->willReturn(5);
|
||||
$this->scoreArgument('argument')->shouldBe(false);
|
||||
}
|
||||
|
||||
function it_is_last_if_preset_token_is_last($token)
|
||||
{
|
||||
$token->isLast()->willReturn(true);
|
||||
$this->shouldBeLast();
|
||||
}
|
||||
|
||||
function it_is_not_last_if_preset_token_is_not_last($token)
|
||||
{
|
||||
$token->isLast()->willReturn(false);
|
||||
$this->shouldNotBeLast();
|
||||
}
|
||||
}
|
101
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/ObjectStateTokenSpec.php
vendored
Normal file
101
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/ObjectStateTokenSpec.php
vendored
Normal file
|
@ -0,0 +1,101 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Argument\Token;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
|
||||
class ObjectStateTokenSpec extends ObjectBehavior
|
||||
{
|
||||
function let()
|
||||
{
|
||||
$this->beConstructedWith('getName', 'stdClass');
|
||||
}
|
||||
|
||||
function it_implements_TokenInterface()
|
||||
{
|
||||
$this->shouldBeAnInstanceOf('Prophecy\Argument\Token\TokenInterface');
|
||||
}
|
||||
|
||||
function it_is_not_last()
|
||||
{
|
||||
$this->shouldNotBeLast();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \ReflectionClass $reflection
|
||||
*/
|
||||
function it_scores_8_if_argument_object_has_specific_method_state($reflection)
|
||||
{
|
||||
$reflection->getName()->willReturn('stdClass');
|
||||
|
||||
$this->scoreArgument($reflection)->shouldReturn(8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \stdClass $class
|
||||
*/
|
||||
function it_scores_8_if_argument_object_has_specific_property_state($class)
|
||||
{
|
||||
$class->getName = 'stdClass';
|
||||
|
||||
$this->scoreArgument($class)->shouldReturn(8);
|
||||
}
|
||||
|
||||
function it_does_not_score_if_argument_method_state_does_not_match()
|
||||
{
|
||||
$value = new ObjectStateTokenFixtureB('ABC');
|
||||
$value2 = new ObjectStateTokenFixtureB('CBA');
|
||||
|
||||
$this->beConstructedWith('getSelf', $value);
|
||||
$this->scoreArgument($value2)->shouldReturn(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \stdClass $class
|
||||
*/
|
||||
function it_does_not_score_if_argument_property_state_does_not_match($class)
|
||||
{
|
||||
$class->getName = 'SplFileInfo';
|
||||
|
||||
$this->scoreArgument($class)->shouldReturn(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \spec\Prophecy\Argument\Token\ObjectStateTokenFixtureA $class
|
||||
*/
|
||||
function it_does_not_score_if_argument_object_does_not_have_method_or_property($class)
|
||||
{
|
||||
$this->scoreArgument($class)->shouldReturn(false);
|
||||
}
|
||||
|
||||
function it_does_not_score_if_argument_is_not_object()
|
||||
{
|
||||
$this->scoreArgument(42)->shouldReturn(false);
|
||||
}
|
||||
|
||||
function it_has_simple_string_representation()
|
||||
{
|
||||
$this->__toString()->shouldReturn('state(getName(), "stdClass")');
|
||||
}
|
||||
}
|
||||
|
||||
class ObjectStateTokenFixtureA
|
||||
{
|
||||
public $errors;
|
||||
}
|
||||
|
||||
class ObjectStateTokenFixtureB extends ObjectStateTokenFixtureA
|
||||
{
|
||||
public $errors;
|
||||
public $value = null;
|
||||
|
||||
public function __construct($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function getSelf()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
}
|
49
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/StringContainsTokenSpec.php
vendored
Normal file
49
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/StringContainsTokenSpec.php
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Argument\Token;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument;
|
||||
|
||||
class StringContainsTokenSpec extends ObjectBehavior
|
||||
{
|
||||
function let()
|
||||
{
|
||||
$this->beConstructedWith('a substring');
|
||||
}
|
||||
|
||||
function it_is_initializable()
|
||||
{
|
||||
$this->shouldHaveType('Prophecy\Argument\Token\StringContainsToken');
|
||||
}
|
||||
|
||||
function it_implements_TokenInterface()
|
||||
{
|
||||
$this->shouldBeAnInstanceOf('Prophecy\Argument\Token\TokenInterface');
|
||||
}
|
||||
|
||||
function it_holds_value()
|
||||
{
|
||||
$this->getValue()->shouldReturn('a substring');
|
||||
}
|
||||
|
||||
function it_is_not_last()
|
||||
{
|
||||
$this->shouldNotBeLast();
|
||||
}
|
||||
|
||||
function it_scores_6_if_the_argument_contains_the_value()
|
||||
{
|
||||
$this->scoreArgument('Argument containing a substring')->shouldReturn(6);
|
||||
}
|
||||
|
||||
function it_does_not_score_if_the_argument_does_not_contain_the_value()
|
||||
{
|
||||
$this->scoreArgument('Argument will not match')->shouldReturn(false);
|
||||
}
|
||||
|
||||
function its_string_representation_shows_substring()
|
||||
{
|
||||
$this->__toString()->shouldReturn('contains("a substring")');
|
||||
}
|
||||
}
|
62
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/TypeTokenSpec.php
vendored
Normal file
62
web/vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/TypeTokenSpec.php
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
namespace spec\Prophecy\Argument\Token;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
|
||||
class TypeTokenSpec extends ObjectBehavior
|
||||
{
|
||||
function let()
|
||||
{
|
||||
$this->beConstructedWith('integer');
|
||||
}
|
||||
|
||||
function it_implements_TokenInterface()
|
||||
{
|
||||
$this->shouldBeAnInstanceOf('Prophecy\Argument\Token\TokenInterface');
|
||||
}
|
||||
|
||||
function it_is_not_last()
|
||||
{
|
||||
$this->shouldNotBeLast();
|
||||
}
|
||||
|
||||
function it_scores_5_if_argument_matches_simple_type()
|
||||
{
|
||||
$this->beConstructedWith('integer');
|
||||
|
||||
$this->scoreArgument(42)->shouldReturn(5);
|
||||
}
|
||||
|
||||
function it_does_not_scores_if_argument_does_not_match_simple_type()
|
||||
{
|
||||
$this->beConstructedWith('integer');
|
||||
|
||||
$this->scoreArgument(42.0)->shouldReturn(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \ReflectionObject $object
|
||||
*/
|
||||
function it_scores_5_if_argument_is_an_instance_of_specified_class($object)
|
||||
{
|
||||
$this->beConstructedWith('ReflectionClass');
|
||||
|
||||
$this->scoreArgument($object)->shouldReturn(5);
|
||||
}
|
||||
|
||||
function it_has_simple_string_representation()
|
||||
{
|
||||
$this->__toString()->shouldReturn('type(integer)');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Prophecy\Argument\Token\TokenInterface $interface
|
||||
*/
|
||||
function it_scores_5_if_argument_is_an_instance_of_specified_interface($interface)
|
||||
{
|
||||
$this->beConstructedWith('Prophecy\Argument\Token\TokenInterface');
|
||||
|
||||
$this->scoreArgument($interface)->shouldReturn(5);
|
||||
}
|
||||
}
|
Reference in a new issue