# Return results when mocking Aerospike calls

**URL:** <https://discuss.aerospike.com/t/return-results-when-mocking-aerospike-calls/4857>\
**Category:** PHP Client Library\
**Created:** [January 10, 2018, 5:30pm UTC](https://discuss.aerospike.com/t/return-results-when-mocking-aerospike-calls/4857 "2018-01-10T17:30:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Crags](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/crags/32/309_2.png) [@Crags](https://discuss.aerospike.com/u/Crags)\
**Post date:** [January 10, 2018, 5:30pm UTC](https://discuss.aerospike.com/t/return-results-when-mocking-aerospike-calls/4857/1 "2018-01-10T17:30:35Z")

</div>

Hi.

I was wondering if there was a way to be able to return results when mocking `Aerospike` client functions?

Example below:

given this piece of code:

```php
// Get the data with optional bins:
$status = $this->getAerospike()->get($key, $record, $binArray, $options);

```

I can mock and test with the following:

```php
$this->mockAerospike->expects($this->once())
    ->method('isConnected')
    ->willReturn(true);

$this->mockAerospike->expects($this->once())
    ->method('get')
    ->with($key, $record, null, $options)
    ->willReturn(Aerospike::OK);

```

As you can see, I can mock the connection so it thinks it’s connected and I can also mock the `get` function, **but** in order for the application to function it checks that `$status === Aerospike::OK` from the request (to indicate that everything worked, the record exists and nothing failed) but what I can’t seem to do is populate the `$record` variable in order for the rest of the function to continue.

Any ideas how I may be able to do this in a testing environment? I’m guessing this must have been done before / talked about?

Thanks

/cc @rbotzer
