update v1.0.3.3
This commit is contained in:
		
							
								
								
									
										110
									
								
								vendor/phpspec/prophecy/spec/Prophecy/Promise/CallbackPromiseSpec.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										110
									
								
								vendor/phpspec/prophecy/spec/Prophecy/Promise/CallbackPromiseSpec.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,110 @@ | ||||
| <?php | ||||
|  | ||||
| namespace spec\Prophecy\Promise; | ||||
|  | ||||
| use PhpSpec\ObjectBehavior; | ||||
|  | ||||
| class CallbackPromiseSpec extends ObjectBehavior | ||||
| { | ||||
|     function let() | ||||
|     { | ||||
|         $this->beConstructedWith('get_class'); | ||||
|     } | ||||
|  | ||||
|     function it_is_promise() | ||||
|     { | ||||
|         $this->shouldBeAnInstanceOf('Prophecy\Promise\PromiseInterface'); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param \Prophecy\Prophecy\ObjectProphecy $object | ||||
|      * @param \Prophecy\Prophecy\MethodProphecy $method | ||||
|      */ | ||||
|     function it_should_execute_closure_callback($object, $method) | ||||
|     { | ||||
|         $firstArgumentCallback = function ($args) { | ||||
|             return $args[0]; | ||||
|         }; | ||||
|  | ||||
|         $this->beConstructedWith($firstArgumentCallback); | ||||
|  | ||||
|         $this->execute(array('one', 'two'), $object, $method)->shouldReturn('one'); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param \Prophecy\Prophecy\ObjectProphecy $object | ||||
|      * @param \Prophecy\Prophecy\MethodProphecy $method | ||||
|      */ | ||||
|     function it_should_execute_static_array_callback($object, $method) | ||||
|     { | ||||
|         $firstArgumentCallback = array('spec\Prophecy\Promise\ClassCallback', 'staticCallbackMethod'); | ||||
|  | ||||
|         $this->beConstructedWith($firstArgumentCallback); | ||||
|  | ||||
|         $this->execute(array('one', 'two'), $object, $method)->shouldReturn('one'); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param \Prophecy\Prophecy\ObjectProphecy $object | ||||
|      * @param \Prophecy\Prophecy\MethodProphecy $method | ||||
|      */ | ||||
|     function it_should_execute_instance_array_callback($object, $method) | ||||
|     { | ||||
|         $class = new ClassCallback(); | ||||
|         $firstArgumentCallback = array($class, 'callbackMethod'); | ||||
|  | ||||
|         $this->beConstructedWith($firstArgumentCallback); | ||||
|  | ||||
|         $this->execute(array('one', 'two'), $object, $method)->shouldReturn('one'); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param \Prophecy\Prophecy\ObjectProphecy $object | ||||
|      * @param \Prophecy\Prophecy\MethodProphecy $method | ||||
|      */ | ||||
|     function it_should_execute_string_function_callback($object, $method) | ||||
|     { | ||||
|         $firstArgumentCallback = 'spec\Prophecy\Promise\functionCallbackFirstArgument'; | ||||
|  | ||||
|         $this->beConstructedWith($firstArgumentCallback); | ||||
|  | ||||
|         $this->execute(array('one', 'two'), $object, $method)->shouldReturn('one'); | ||||
|     } | ||||
|  | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Class used to test callbackpromise | ||||
|  * | ||||
|  * @param array | ||||
|  * @return string | ||||
|  */ | ||||
| class ClassCallback | ||||
| { | ||||
|     /** | ||||
|      * @param array $args | ||||
|      */ | ||||
|     function callbackMethod($args) | ||||
|     { | ||||
|         return $args[0]; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param array $args | ||||
|      */ | ||||
|     static function staticCallbackMethod($args) | ||||
|     { | ||||
|         return $args[0]; | ||||
|     } | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Callback function used to test callbackpromise | ||||
|  * | ||||
|  * @param array | ||||
|  * @return string | ||||
|  */ | ||||
| function functionCallbackFirstArgument($args) | ||||
| { | ||||
|     return $args[0]; | ||||
| } | ||||
							
								
								
									
										41
									
								
								vendor/phpspec/prophecy/spec/Prophecy/Promise/ReturnArgumentPromiseSpec.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								vendor/phpspec/prophecy/spec/Prophecy/Promise/ReturnArgumentPromiseSpec.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,41 @@ | ||||
| <?php | ||||
|  | ||||
| namespace spec\Prophecy\Promise; | ||||
|  | ||||
| use PhpSpec\ObjectBehavior; | ||||
|  | ||||
| class ReturnArgumentPromiseSpec extends ObjectBehavior | ||||
| { | ||||
|     function it_is_promise() | ||||
|     { | ||||
|         $this->shouldBeAnInstanceOf('Prophecy\Promise\PromiseInterface'); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param \Prophecy\Prophecy\ObjectProphecy $object | ||||
|      * @param \Prophecy\Prophecy\MethodProphecy $method | ||||
|      */ | ||||
|     function it_should_return_first_argument_if_provided($object, $method) | ||||
|     { | ||||
|         $this->execute(array('one', 'two'), $object, $method)->shouldReturn('one'); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param \Prophecy\Prophecy\ObjectProphecy $object | ||||
|      * @param \Prophecy\Prophecy\MethodProphecy $method | ||||
|      */ | ||||
|     function it_should_return_null_if_no_arguments_provided($object, $method) | ||||
|     { | ||||
|         $this->execute(array(), $object, $method)->shouldReturn(null); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param \Prophecy\Prophecy\ObjectProphecy $object | ||||
|      * @param \Prophecy\Prophecy\MethodProphecy $method | ||||
|      */ | ||||
|     function it_should_return_nth_argument_if_provided($object, $method) | ||||
|     { | ||||
|         $this->beConstructedWith(1); | ||||
|         $this->execute(array('one', 'two'), $object, $method)->shouldReturn('two'); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										61
									
								
								vendor/phpspec/prophecy/spec/Prophecy/Promise/ReturnPromiseSpec.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								vendor/phpspec/prophecy/spec/Prophecy/Promise/ReturnPromiseSpec.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,61 @@ | ||||
| <?php | ||||
|  | ||||
| namespace spec\Prophecy\Promise; | ||||
|  | ||||
| use PhpSpec\ObjectBehavior; | ||||
|  | ||||
| class ReturnPromiseSpec extends ObjectBehavior | ||||
| { | ||||
|     function let() | ||||
|     { | ||||
|         $this->beConstructedWith(array(42)); | ||||
|     } | ||||
|  | ||||
|     function it_is_promise() | ||||
|     { | ||||
|         $this->shouldBeAnInstanceOf('Prophecy\Promise\PromiseInterface'); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param \Prophecy\Prophecy\ObjectProphecy $object | ||||
|      * @param \Prophecy\Prophecy\MethodProphecy $method | ||||
|      */ | ||||
|     function it_returns_value_it_was_constructed_with($object, $method) | ||||
|     { | ||||
|         $this->execute(array(), $object, $method)->shouldReturn(42); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param \Prophecy\Prophecy\ObjectProphecy $object | ||||
|      * @param \Prophecy\Prophecy\MethodProphecy $method | ||||
|      */ | ||||
|     function it_always_returns_last_value_left_in_the_return_values($object, $method) | ||||
|     { | ||||
|         $this->execute(array(), $object, $method)->shouldReturn(42); | ||||
|         $this->execute(array(), $object, $method)->shouldReturn(42); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param \Prophecy\Prophecy\ObjectProphecy $object | ||||
|      * @param \Prophecy\Prophecy\MethodProphecy $method | ||||
|      */ | ||||
|     function it_consequently_returns_multiple_values_it_was_constructed_with($object, $method) | ||||
|     { | ||||
|         $this->beConstructedWith(array(42, 24, 12)); | ||||
|  | ||||
|         $this->execute(array(), $object, $method)->shouldReturn(42); | ||||
|         $this->execute(array(), $object, $method)->shouldReturn(24); | ||||
|         $this->execute(array(), $object, $method)->shouldReturn(12); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param \Prophecy\Prophecy\ObjectProphecy $object | ||||
|      * @param \Prophecy\Prophecy\MethodProphecy $method | ||||
|      */ | ||||
|     function it_returns_null_if_constructed_with_empty_array($object, $method) | ||||
|     { | ||||
|         $this->beConstructedWith(array()); | ||||
|  | ||||
|         $this->execute(array(), $object, $method)->shouldReturn(null); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										58
									
								
								vendor/phpspec/prophecy/spec/Prophecy/Promise/ThrowPromiseSpec.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								vendor/phpspec/prophecy/spec/Prophecy/Promise/ThrowPromiseSpec.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,58 @@ | ||||
| <?php | ||||
|  | ||||
| namespace spec\Prophecy\Promise; | ||||
|  | ||||
| use PhpSpec\ObjectBehavior; | ||||
|  | ||||
| class ThrowPromiseSpec extends ObjectBehavior | ||||
| { | ||||
|     function let() | ||||
|     { | ||||
|         $this->beConstructedWith('RuntimeException'); | ||||
|     } | ||||
|  | ||||
|     function it_is_promise() | ||||
|     { | ||||
|         $this->shouldBeAnInstanceOf('Prophecy\Promise\PromiseInterface'); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param \Prophecy\Prophecy\ObjectProphecy $object | ||||
|      * @param \Prophecy\Prophecy\MethodProphecy $method | ||||
|      */ | ||||
|     function it_instantiates_and_throws_exception_from_provided_classname($object, $method) | ||||
|     { | ||||
|         $this->beConstructedWith('InvalidArgumentException'); | ||||
|  | ||||
|         $this->shouldThrow('InvalidArgumentException') | ||||
|             ->duringExecute(array(), $object, $method); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param \Prophecy\Prophecy\ObjectProphecy $object | ||||
|      * @param \Prophecy\Prophecy\MethodProphecy $method | ||||
|      */ | ||||
|     function it_instantiates_exceptions_with_required_arguments($object, $method) | ||||
|     { | ||||
|         $this->beConstructedWith('spec\Prophecy\Promise\RequiredArgumentException'); | ||||
|  | ||||
|         $this->shouldThrow('spec\Prophecy\Promise\RequiredArgumentException') | ||||
|             ->duringExecute(array(), $object, $method); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param \Prophecy\Prophecy\ObjectProphecy $object | ||||
|      * @param \Prophecy\Prophecy\MethodProphecy $method | ||||
|      */ | ||||
|     function it_throws_provided_exception($object, $method) | ||||
|     { | ||||
|         $this->beConstructedWith($exc = new \RuntimeException('Some exception')); | ||||
|  | ||||
|         $this->shouldThrow($exc)->duringExecute(array(), $object, $method); | ||||
|     } | ||||
| } | ||||
|  | ||||
| class RequiredArgumentException extends \Exception | ||||
| { | ||||
|     final public function __construct($message, $code) {} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 sujitprasad
					sujitprasad