Skip to content

Commit

Permalink
setExpectedException is deleted in PHPUnit 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ackintosh committed Nov 19, 2018
1 parent b3495ec commit 15e00ae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ public function testAsyncRequestWithHttpInfo()
$this->assertInstanceOf(Pet::class, $pet);
}

/**
* @expectedException \OpenAPI\Client\ApiException
*/
public function testAsyncThrowingException()
{
$this->setExpectedException(ApiException::class);

$promise = $this->api->getPetByIdAsync(0);
$promise->wait();
}
Expand All @@ -76,10 +77,11 @@ public function testAsyncApiExceptionWithoutWaitIsNotThrown()
sleep(1);
}

/**
* @expectedException \OpenAPI\Client\ApiException
*/
public function testAsyncHttpInfoThrowingException()
{
$this->setExpectedException(ApiException::class);

$promise = $this->api->getPetByIdAsyncWithHttpInfo(0);
$promise->wait();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ public function testDeserialize()
$this->assertEquals('placed', $result);
}

/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Invalid value for enum
*/
public function testDeserializeInvalidValue()
{
$this->setExpectedException(\InvalidArgumentException::class, 'Invalid value for enum');

ObjectSerializer::deserialize(
"lkjfalgkdfjg",
OuterEnum::class
Expand Down Expand Up @@ -79,10 +81,12 @@ public function testSanitizeNested()
$this->assertEquals('approved', $result->outerEnum);
}

/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Invalid value for enum
*/
public function testSanitizeNestedInvalidValue()
{
$this->setExpectedException(\InvalidArgumentException::class, 'Invalid value for enum');

$input = new EnumTest([
'enum_string' => 'UPPER',
'enum_integer' => -1,
Expand Down

0 comments on commit 15e00ae

Please sign in to comment.