~tcuthbert/wordpress/openstack-objectstorage

« back to all changes in this revision

Viewing changes to vendor/phpunit/phpunit-mock-objects/tests/MockObject/Matcher/ConsecutiveParametersTest.php

  • Committer: Jacek Nykis
  • Date: 2015-02-11 15:35:31 UTC
  • Revision ID: jacek.nykis@canonical.com-20150211153531-hmy6zi0ov2qfkl0b
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
class Framework_MockObject_Matcher_ConsecutiveParametersTest extends PHPUnit_Framework_TestCase
 
3
{
 
4
    public function testIntegration()
 
5
    {
 
6
        $mock = $this->getMock('stdClass', array('foo'));
 
7
        $mock
 
8
            ->expects($this->any())
 
9
            ->method('foo')
 
10
            ->withConsecutive(
 
11
                array('bar'),
 
12
                array(21, 42)
 
13
            );
 
14
        $mock->foo('bar');
 
15
        $mock->foo(21, 42);
 
16
    }
 
17
 
 
18
    public function testIntegrationWithLessAssertionsThenMethodCalls()
 
19
    {
 
20
        $mock = $this->getMock('stdClass', array('foo'));
 
21
        $mock
 
22
            ->expects($this->any())
 
23
            ->method('foo')
 
24
            ->withConsecutive(
 
25
              array('bar')
 
26
            );
 
27
        $mock->foo('bar');
 
28
        $mock->foo(21, 42);
 
29
    }
 
30
 
 
31
    public function testIntegrationExpectingException()
 
32
    {
 
33
        $mock = $this->getMock('stdClass', array('foo'));
 
34
        $mock
 
35
            ->expects($this->any())
 
36
            ->method('foo')
 
37
            ->withConsecutive(
 
38
                array('bar'),
 
39
                array(21, 42)
 
40
            );
 
41
        $mock->foo('bar');
 
42
        $this->setExpectedException('PHPUnit_Framework_ExpectationFailedException');
 
43
        $mock->foo('invalid');
 
44
    }
 
45
}
 
 
b'\\ No newline at end of file'