~tcuthbert/wordpress/openstack-objectstorage

« back to all changes in this revision

Viewing changes to vendor/phpunit/phpunit-mock-objects/tests/MockObject/Invocation/StaticTest.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
 
 
3
class Framework_MockObject_Invocation_StaticTest extends PHPUnit_Framework_TestCase
 
4
{
 
5
    public function testConstructorRequiresClassAndMethodAndParameters()
 
6
    {
 
7
        new PHPUnit_Framework_MockObject_Invocation_Static('FooClass', 'FooMethod', array('an_argument'));
 
8
    }
 
9
 
 
10
    public function testAllowToGetClassNameSetInConstructor()
 
11
    {
 
12
        $invocation = new PHPUnit_Framework_MockObject_Invocation_Static('FooClass', 'FooMethod', array('an_argument'));
 
13
 
 
14
        $this->assertSame('FooClass', $invocation->className);
 
15
    }
 
16
 
 
17
    public function testAllowToGetMethodNameSetInConstructor()
 
18
    {
 
19
        $invocation = new PHPUnit_Framework_MockObject_Invocation_Static('FooClass', 'FooMethod', array('an_argument'));
 
20
 
 
21
        $this->assertSame('FooMethod', $invocation->methodName);
 
22
    }
 
23
 
 
24
    public function testAllowToGetMethodParametersSetInConstructor()
 
25
    {
 
26
        $expectedParameters = array(
 
27
          'foo', 5, array('a', 'b'), new StdClass, NULL, FALSE
 
28
        );
 
29
 
 
30
        $invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
 
31
          'FooClass', 'FooMethod', $expectedParameters
 
32
        );
 
33
 
 
34
        $this->assertSame($expectedParameters, $invocation->parameters);
 
35
    }
 
36
 
 
37
    public function testConstructorAllowToSetFlagCloneObjectsInParameters()
 
38
    {
 
39
        $parameters = array(new StdClass);
 
40
        $cloneObjects = TRUE;
 
41
 
 
42
        $invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
 
43
          'FooClass',
 
44
          'FooMethod',
 
45
          $parameters,
 
46
          $cloneObjects
 
47
        );
 
48
 
 
49
        $this->assertEquals($parameters, $invocation->parameters);
 
50
        $this->assertNotSame($parameters, $invocation->parameters);
 
51
    }
 
52
}