send() public method

Send a message to the queue.
public send ( array $payload, integer $earliestGet, float $priority ) : void
$payload array the data to store in the message. Data is handled same way as \MongoDB\Collection::insertOne()
$earliestGet integer earliest unix timestamp the message can be retreived.
$priority float priority for order out of get(). 0 is higher priority than 1
return void
 /**
  * Verify Queue can be constructed with \MongoDB\Collection
  *
  * @test
  * @covers ::__construct
  *
  * @return void
  */
 public function constructWithCollection()
 {
     $mongo = new \MongoDB\Client($this->mongoUrl, [], ['typeMap' => ['root' => 'array', 'document' => 'array', 'array' => 'array']]);
     $collection = $mongo->selectDatabase('testing')->selectCollection('custom_collection');
     $collection->drop();
     $queue = new Queue($collection);
     $payload = ['key1' => 0, 'key2' => true];
     $queue->send($payload, 34, 0.8);
     $expected = ['payload' => $payload, 'running' => false, 'resetTimestamp' => (new UTCDateTime(Queue::MONGO_INT32_MAX))->toDateTime()->getTimestamp(), 'earliestGet' => 34, 'priority' => 0.8];
     $this->assertSame(1, $collection->count());
     $message = $collection->findOne();
     $this->assertLessThanOrEqual(time(), $message['created']->toDateTime()->getTimestamp());
     $this->assertGreaterThan(time() - 10, $message['created']->toDateTime()->getTimestamp());
     unset($message['_id'], $message['created']);
     $message['resetTimestamp'] = $message['resetTimestamp']->toDateTime()->getTimestamp();
     $message['earliestGet'] = $message['earliestGet']->toDateTime()->getTimestamp();
     $this->assertSame($expected, $message);
 }