Exemple #1
0
 /**
  * (PHP 5 >= 5.1.0)
  * Count elements of an object
  * @link http://php.net/manual/en/countable.count.php
  *
  * @return int The custom count as an integer.
  */
 public function count()
 {
     return (int) FileHelper::getLineCount($this->queueFile);
 }
 /**
  * @covers \DCarbone\UglyQueue::addItem
  * @uses \DCarbone\UglyQueue
  * @uses \DCarbone\Helpers\FileHelper
  * @depends testCanLockQueueWithValidIntegerValue
  * @param \DCarbone\UglyQueue $uglyQueue
  * @return \DCarbone\UglyQueue
  */
 public function testCanPopulateQueueTempFileAfterInitializationAndAcquiringLock(\DCarbone\UglyQueue $uglyQueue)
 {
     foreach (array_reverse($this->tastySandwich, true) as $k => $v) {
         $added = $uglyQueue->addItem($k, $v);
         $this->assertTrue($added);
     }
     $this->assertFileExists($uglyQueue->getQueueTmpFile(), 'queue.tmp file was not created!');
     $lineCount = \DCarbone\Helpers\FileHelper::getLineCount($uglyQueue->getQueueTmpFile());
     $this->assertEquals(11, $lineCount);
     return $uglyQueue;
 }