| | 28 | |
| | 29 | /** |
| | 30 | * @ticket 19733 |
| | 31 | */ |
| | 32 | function test__convert_date() { |
| | 33 | // Use reflection to grab the protected method _convert_date() |
| | 34 | $reflection = new ReflectionClass( get_class( $this->myxmlrpcserver ) ); |
| | 35 | $_convert_date = $reflection->getMethod( '_convert_date' ); |
| | 36 | $_convert_date->setAccessible( true ); |
| | 37 | |
| | 38 | /** Standard Date *********************************************************************************************/ |
| | 39 | |
| | 40 | // Set up |
| | 41 | $good_date = '1983-11-09 05:00:00'; |
| | 42 | $expected = new IXR_Date( '19831109T05:00:00' ); |
| | 43 | |
| | 44 | // Result |
| | 45 | $result = $_convert_date->invokeArgs( $this->myxmlrpcserver, array( $good_date ) ); |
| | 46 | |
| | 47 | // Verify |
| | 48 | $this->assertEquals( $expected, $result ); |
| | 49 | |
| | 50 | /** Null Date *************************************************************************************************/ |
| | 51 | |
| | 52 | // Set up |
| | 53 | $null_date = '0000-00-00 00:00:00'; |
| | 54 | $expected = new IXR_Date( '00000000T00:00:00Z' ); |
| | 55 | |
| | 56 | // Result |
| | 57 | $result = $_convert_date->invokeArgs( $this->myxmlrpcserver, array( $null_date ) ); |
| | 58 | |
| | 59 | // Verify |
| | 60 | $this->assertEquals( $expected, $result ); |
| | 61 | } |
| | 62 | |
| | 63 | /** |
| | 64 | * @ticket 19733 |
| | 65 | */ |
| | 66 | function test__convert_date_gmt() { |
| | 67 | // Use reflection to grab the protected method _convert_date_gmt() |
| | 68 | $reflection = new ReflectionClass( get_class( $this->myxmlrpcserver ) ); |
| | 69 | $_convert_date_gmt = $reflection->getMethod( '_convert_date_gmt' ); |
| | 70 | $_convert_date_gmt->setAccessible( true ); |
| | 71 | |
| | 72 | /** Standard Date *********************************************************************************************/ |
| | 73 | |
| | 74 | // Set up |
| | 75 | $good_date = '1983-11-09 05:00:00'; |
| | 76 | $expected = new IXR_Date( '19831109T05:00:00' ); |
| | 77 | |
| | 78 | // Result |
| | 79 | $result = $_convert_date_gmt->invokeArgs( $this->myxmlrpcserver, array( $good_date, $good_date ) ); |
| | 80 | |
| | 81 | // Verify |
| | 82 | $this->assertEquals( $expected, $result ); |
| | 83 | |
| | 84 | /** Null Date *************************************************************************************************/ |
| | 85 | |
| | 86 | // Set up |
| | 87 | $null_date = '0000-00-00 00:00:00'; |
| | 88 | $expected = new IXR_Date( '00000000T00:00:00Z' ); |
| | 89 | |
| | 90 | // Result |
| | 91 | $result = $_convert_date_gmt->invokeArgs( $this->myxmlrpcserver, array( $null_date, $null_date ) ); |
| | 92 | |
| | 93 | // Verify |
| | 94 | $this->assertEquals( $expected, $result ); |
| | 95 | } |