public function thereIsAnItemInTheSystemQueue(TableNode $table)
    {
        // Gather the data.
        $fields = $table->getRowsHash();

        // Default data field separately since this is longish.
        if (empty($fields['data'])) {
            $fields['data'] = json_encode([]);
        }

        // @see SystemQueue::createItem().
        $query = db_insert('queue')
        ->fields(array(
        'name' => $fields['name'] ?: user_password(),
        'data' => serialize(json_decode($fields['data'])),
        'created' => $fields['created'] ?: REQUEST_TIME,
        'expire' => $fields['expire'] ?: 0,
        ));
        if (!$query->execute()) {
            throw new Exception('Unable to create the queue item.');
        }
    }
public function thereIsAnItemInTheSystemQueue(TableNode $table)
    {
        // Gather the data.
        $fields = $table->getRowsHash();

        // Default data field separately since this is longish.
        if (empty($fields['data'])) {
            $fields['data'] = json_encode([]);
        }

        // @see SystemQueue::createItem().
        $query = db_insert('queue')
        ->fields(array(
        'name' => $fields['name'] ?: user_password(),
        'data' => serialize(json_decode($fields['data'])),
        'created' => $fields['created'] ?: REQUEST_TIME,
        'expire' => $fields['expire'] ?: 0,
        ));
        if (!$query->execute()) {
            throw new Exception('Unable to create the queue item.');
        }
    }
public function thereIsAnItemInTheSystemQueue ( TableNode $ table ) { // Gather the data. $ fields = $ table -> getRowsHash ( ) ; // Default data field separately since this is longish. if ( empty ( $ fields [ 'data' ] ) ) { $ fields [ 'data' ] = json_encode ( [ ] ) ; } // @see SystemQueue::createItem(). $ query = db_insert ( 'queue' ) -> fields ( array ( 'name' => $ fields [ 'name' ] ? : user_password ( ) , 'data' => serialize ( json_decode ( $ fields [ 'data' ] ) ) , 'created' => $ fields [ 'created' ] ? : REQUEST_TIME , 'expire' => $ fields [ 'expire' ] ? : 0 , ) ) ; if ( ! $ query -> execute ( ) ) { throw new Exception ( 'Unable to create the queue item.' ) ; } }
Creates a queue item. Defaults inputs if none are available.

Expects the `data` to be a json encoded string.

@Given there is an item in the system queue:
Creates a queue item . Defaults inputs if none are available .