| @@ 72-81 (lines=10) @@ | ||
| 69 | /** |
|
| 70 | * @covers Automattic\Jetpack\Abtest::get_variation |
|
| 71 | */ |
|
| 72 | public function test_when_error_or_malformed_response() { |
|
| 73 | $this->abtest->expects( $this->once() ) |
|
| 74 | ->method( 'request_variation' ) |
|
| 75 | ->willReturn( [ |
|
| 76 | 'status' => 500, |
|
| 77 | ] ); |
|
| 78 | ||
| 79 | $result = $this->abtest->get_variation( 'some_test' ); |
|
| 80 | $this->assertNull( $result ); |
|
| 81 | } |
|
| 82 | ||
| 83 | /** |
|
| 84 | * @covers Automattic\Jetpack\Abtest::get_variation |
|
| @@ 86-97 (lines=12) @@ | ||
| 83 | /** |
|
| 84 | * @covers Automattic\Jetpack\Abtest::get_variation |
|
| 85 | */ |
|
| 86 | public function test_when_response_in_unexpected_format() { |
|
| 87 | $this->abtest->expects( $this->once() ) |
|
| 88 | ->method( 'request_variation' ) |
|
| 89 | ->willReturn( [ |
|
| 90 | 'body' => json_encode( [ |
|
| 91 | 'foo' => 'bar', |
|
| 92 | ] ), |
|
| 93 | ] ); |
|
| 94 | ||
| 95 | $result = $this->abtest->get_variation( 'some_test' ); |
|
| 96 | $this->assertNull( $result ); |
|
| 97 | } |
|
| 98 | ||
| 99 | /** |
|
| 100 | * @covers Automattic\Jetpack\Abtest::get_variation |
|