Skip to content

Advanced seeInDatabase query #9292

@brayniverse

Description

@brayniverse

At the moment it doesn't seem possible to check whether a value != something.

If you change the $data parameter, on this line, to allow for either an array or callable value it becomes possible to provide a more complex query.

Proposed change

/**
 * Assert that a given where condition exists in the database.
 * 
 * @param  string  $table
 * @param  array|callable  $data
 * @param  string  $connection
 * @return $this
 */
protected function seeInDatabase($table, $data, $connection = null)
{
    // ...
}

This will also need to be reflected on lines 239 and 252.

Example use case

$this->seeInDatabase('vehicles', function($query) use ($vehicle)
{
    $query->where('id', $vehicle->id)
        ->whereNotNull('discontinued_at');
});

Would this be beneficial to anybody, are there any circumstance where it could break?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions