1<?php 2class 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 41class Issue244Exception extends Exception 42{ 43 public function __construct() 44 { 45 $this->code = '123StringCode'; 46 } 47} 48 49class Issue244ExceptionIntCode extends Exception 50{ 51 public function __construct() 52 { 53 $this->code = 123; 54 } 55} 56