---
title: "Discussion on \"Write Deterministic PHPUnit Assertions with Mockery::capture\" | Hashnode"
description: "Discussion on \"Write Deterministic PHPUnit Assertions with Mockery::capture\". When a method uses random_int internally, Mockery::capture with passthru captures the intermediate value so you can compute the expected result and assert it."
url: "https://hashnode.com/posts/mockery-capturing-arguments/69a63e32edbe7b25ac9f577e"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Write Deterministic PHPUnit Assertions with Mockery::capture](https://recca0120.hashnode.dev/mockery-capturing-arguments?utm_source=hashnode&utm_medium=feed)

When a method uses random\_int internally, Mockery::capture with passthru captures the intermediate value so you can compute the expected result and assert it.

Mar 3 · 2 min read · recca0120.hashnode.dev  
Read the article

-   [#mockery](https://hashnode.com/tag/mockery)
-   [#php](https://hashnode.com/tag/php)
-   [#phpunit](https://hashnode.com/tag/phpunit)
-   [#testing](https://hashnode.com/tag/testing)

## Written by

[recca0120](https://hashnode.com/@recca0120)

@recca0120 · Taipei, Taiwan

  
[View profile](https://hashnode.com/@recca0120)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
