~tcuthbert/wordpress/openstack-objectstorage

« back to all changes in this revision

Viewing changes to vendor/phpunit/phpunit/tests/Regression/GitHub/244/Issue244Test.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 Issue244Test extends PHPUnit_Framework_TestCase
 
3
{
 
4
    /**
 
5
     * @expectedException Issue244Exception
 
6
     * @expectedExceptionCode 123StringCode
 
7
     */
 
8
    public function testWorks()
 
9
    {
 
10
        throw new Issue244Exception;
 
11
    }
 
12
 
 
13
    /**
 
14
     * @expectedException Issue244Exception
 
15
     * @expectedExceptionCode OtherString
 
16
     */
 
17
    public function testFails()
 
18
    {
 
19
        throw new Issue244Exception;
 
20
    }
 
21
 
 
22
    /**
 
23
     * @expectedException Issue244Exception
 
24
     * @expectedExceptionCode 123
 
25
     */
 
26
    public function testFailsTooIfExpectationIsANumber()
 
27
    {
 
28
        throw new Issue244Exception;
 
29
    }
 
30
 
 
31
    /**
 
32
     * @expectedException Issue244ExceptionIntCode
 
33
     * @expectedExceptionCode 123String
 
34
     */
 
35
    public function testFailsTooIfExceptionCodeIsANumber()
 
36
    {
 
37
        throw new Issue244ExceptionIntCode;
 
38
    }
 
39
}
 
40
 
 
41
class Issue244Exception extends Exception
 
42
{
 
43
    public function __construct()
 
44
    {
 
45
        $this->code = '123StringCode';
 
46
    }
 
47
}
 
48
 
 
49
class Issue244ExceptionIntCode extends Exception
 
50
{
 
51
    public function __construct()
 
52
    {
 
53
        $this->code = 123;
 
54
    }
 
55
}