Skip to content

Commit

Permalink
Added context tests
Browse files Browse the repository at this point in the history
  • Loading branch information
khelle committed Jul 9, 2017
1 parent 65b14f5 commit 519e8d4
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/TUnit/ErrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,30 @@ public function testApiDestructor_DoesNotThrowError()
unset($ex);
}

/**
*
*/
public function testApiSetContext_SetsContext()
{
$ex = $this->createError('Error');

$ex->setContext($context = [ 5, 'ABC', new \StdClass ]);

$this->assertSame($context, $this->getProtectedProperty($ex, 'context'));
}

/**
*
*/
public function testApiGetContext_GetsContext()
{
$ex = $this->createError('Error');

$ex->setContext($context = [ 5, 'ABC', new \StdClass ]);

$this->assertSame($context, $ex->getContext());
}

/**
*
*/
Expand Down
24 changes: 24 additions & 0 deletions test/TUnit/ExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,30 @@ public function testApiDestructor_DoesNotThrowException()
unset($ex);
}

/**
*
*/
public function testApiSetContext_SetsContext()
{
$ex = $this->createException('Exception');

$ex->setContext($context = [ 5, 'ABC', new \StdClass ]);

$this->assertSame($context, $this->getProtectedProperty($ex, 'context'));
}

/**
*
*/
public function testApiGetContext_GetsContext()
{
$ex = $this->createException('Exception');

$ex->setContext($context = [ 5, 'ABC', new \StdClass ]);

$this->assertSame($context, $ex->getContext());
}

/**
*
*/
Expand Down
24 changes: 24 additions & 0 deletions test/TUnit/ThrowableProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,30 @@ public function testApiDestructor_DoesNotThrowException()
unset($proxy);
}

/**
*
*/
public function testApiSetContext_SetsContext()
{
$ex = $this->createThrowableProxy('');

$ex->setContext($context = [ 5, 'ABC', new \StdClass ]);

$this->assertSame($context, $this->getProtectedProperty($ex, 'context'));
}

/**
*
*/
public function testApiGetContext_GetsContext()
{
$ex = $this->createThrowableProxy('');

$ex->setContext($context = [ 5, 'ABC', new \StdClass ]);

$this->assertSame($context, $ex->getContext());
}

/**
*
*/
Expand Down

0 comments on commit 519e8d4

Please sign in to comment.