File: ReturnArgumentPromiseSpec.php

package info (click to toggle)
php-phpspec-prophecy 1.22.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,376 kB
  • sloc: php: 9,909; makefile: 16
file content (31 lines) | stat: -rw-r--r-- 951 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php

namespace spec\Prophecy\Promise;

use PhpSpec\ObjectBehavior;
use Prophecy\Prophecy\MethodProphecy;
use Prophecy\Prophecy\ObjectProphecy;

class ReturnArgumentPromiseSpec extends ObjectBehavior
{
    function it_is_promise()
    {
        $this->shouldBeAnInstanceOf('Prophecy\Promise\PromiseInterface');
    }

    function it_should_return_first_argument_if_provided(ObjectProphecy $object, MethodProphecy $method)
    {
        $this->execute(array('one', 'two'), $object, $method)->shouldReturn('one');
    }

    function it_should_return_null_if_no_arguments_provided(ObjectProphecy $object, MethodProphecy $method)
    {
        $this->execute(array(), $object, $method)->shouldReturn(null);
    }

    function it_should_return_nth_argument_if_provided(ObjectProphecy $object, MethodProphecy $method)
    {
        $this->beConstructedWith(1);
        $this->execute(array('one', 'two'), $object, $method)->shouldReturn('two');
    }
}