18 Commits

Author SHA1 Message Date
a6ecf19932 fix: Fixing CI. Added directory listing 👷🔥
Some checks failed
CI / release (push) Successful in 13s
Create Distribution / Create Archive (push) Failing after 5s
2024-10-29 21:37:39 +13:00
942c4e8699 fix: Fixing CI. Separate flow for upload 👷🔥
Some checks failed
CI / release (push) Successful in 14s
Create Distribution / Create Archive (push) Failing after 4s
2024-10-29 21:31:10 +13:00
d9d01fcbb3 fix: Fixing CI. Separate flow for upload 👷🔥
Some checks failed
CI / release (push) Successful in 1m47s
Create Distribution / Create Archive (push) Failing after 2s
2024-10-29 21:10:53 +13:00
de1973025f fix: Exclude generated changelog 🔥
All checks were successful
CI / release (push) Successful in 16s
2024-10-24 23:03:56 +13:00
dede25ec32 fix: Do not include semrel folder 🔥
All checks were successful
CI / release (push) Successful in 16s
2024-10-24 22:59:47 +13:00
607d3a9004 fix: Relabelling namespace/package names ♻️
All checks were successful
CI / release (push) Successful in 24s
2024-10-24 22:38:37 +13:00
032be45f9f fix: Create .zip archive instead of .tar.gz for Gitea 💚👷
All checks were successful
CI / release (push) Successful in 42s
2024-10-24 22:25:21 +13:00
afbddabea2 chore: Updated repo path 🔨 2024-10-24 22:24:23 +13:00
2ec085419f fix: Updated build script 🔨💚
All checks were successful
CI / release (push) Successful in 22s
2024-10-24 16:58:31 +13:00
7657af0a55 fix: Updated build script 🔨💚
All checks were successful
CI / release (push) Successful in 19s
2024-10-24 16:55:02 +13:00
8b87324850 ci: Use gitea provider from go-semantic-release 💚
All checks were successful
CI / release (push) Successful in 21s
2024-10-24 16:41:41 +13:00
25c80c4baf chore: Updated gitignore 🙈
Some checks failed
CI / release (push) Failing after 2m21s
2024-10-24 16:36:53 +13:00
afc24185d3 ci: Added Gitea Actions config 👷 2024-10-24 16:36:25 +13:00
e1cac1e31d fix: Don't break on whitespace. Helpful for JSON 🐛 2024-10-24 16:26:31 +13:00
0c05079327 tests: Updated tests for later PHPUnit 🔥 2024-10-24 15:37:18 +13:00
7526e04e08 chore: Update namespace 2024-10-24 15:36:26 +13:00
b84bde262e ⬆️ chore: Change namespace 2024-10-24 15:34:40 +13:00
a2b204fa47 Update README.md 2015-10-13 15:49:15 -05:00
12 changed files with 361 additions and 255 deletions

23
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: CI
on:
push:
branches:
- "**"
tags:
- "!**"
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Release Archive
id: semrelease
uses: go-semantic-release/action@v1
with:
# custom-arguments: --provider=gitea
hooks: exec
env:
GITEA_TOKEN: ${{ secrets.G_TOKEN }}
GITEA_HOST: ${{ secrets.G_SERVER_URL}}

24
.github/workflows/dist.yml vendored Normal file
View File

@@ -0,0 +1,24 @@
name: Create Distribution
run-name: Distribute composer package with Gitea Actions 🚀
on:
push:
tags:
- 'v*'
jobs:
dist:
name: Create Archive
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 # Checkout Sourcecode
- uses: https://hub.cybercinch.nz/cybercinch/composer-build-action@v1
- run: |
ls -lah
- uses: https://hub.cybercinch.nz/guisea/gitea-composer-upload-action@v1
with:
base_url: "${{ secrets.G_SERVER_URL}}"
access_token: "${{ secrets.G_TOKEN }}"
username: "${{ secrets.G_USERNAME }}"
owner: "cybercinch" # Override owner name for repository (Optional)
package_version: "${{ env.GITHUB_REF_NAME }}"

4
.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
**/vendor
tests/misc/*
!tests/misc/cleanup.php
!tests/misc/index.html

21
.semrelrc Normal file
View File

@@ -0,0 +1,21 @@
{
"plugins": {
"provider": {
"name": "gitea"
},
"changelog-generator": {
"name": "default",
"options": {
"emojis": "true"
}
},
"hooks": {
"names": [
"exec"
],
"options": {
"exec_on_no_release": "echo {{.Reason}}: {{.Message}}"
}
}
}
}

View File

@@ -3,16 +3,14 @@ ugly-queue
A simple file-based FIFO queue system for PHP 5.3.3+ A simple file-based FIFO queue system for PHP 5.3.3+
Build statuses: Build status: [![Build Status](https://travis-ci.org/Cybercinch/ugly-queue.svg?branch=master)](https://travis-ci.org/Cybercinch/ugly-queue)
- master: [![Build Status](https://travis-ci.org/dcarbone/ugly-queue.svg?branch=master)](https://travis-ci.org/dcarbone/ugly-queue)
- 0.3.1: [![Build Status](https://travis-ci.org/dcarbone/ugly-queue.svg?branch=0.3.1)](https://travis-ci.org/dcarbone/ugly-queue)
## Installation ## Installation
This library is designed to be installed into your app using [https://getcomposer.org/](Composer). This library is designed to be installed into your app using [https://getcomposer.org/](Composer).
Simply copy-paste the following line into your `"requires:"` hash: Simply copy-paste the following line into your `"requires:"` hash:
```json ```json
"dcarbone/ugly-queue": "0.3.*" "dcarbone/ugly-queue": "0.4.*"
``` ```
## Basic Usage ## Basic Usage
@@ -57,10 +55,10 @@ $queueBaseDir = 'path to where you would like queue files and directories to be
$manager = new UglyQueueManager($queueBaseDir); $manager = new UglyQueueManager($queueBaseDir);
// 'tasty-sandwich' queue will exist now
$tastySandwich = $manager->getQueue('sandwiches'); $tastySandwich = $manager->getQueue('sandwiches');
// 'sandwiches' queue will exist now
$tastySandwich->lock(); $tastySandwich->lock();
// Specify the number of items you wish to retrieve from the queue // Specify the number of items you wish to retrieve from the queue

View File

@@ -1,5 +1,5 @@
{ {
"name" : "dcarbone/ugly-queue", "name" : "cybercinch/ugly-queue",
"type" : "library", "type" : "library",
"description" : "A simple file-based queue system for PHP 5.3.3+", "description" : "A simple file-based queue system for PHP 5.3.3+",
@@ -9,28 +9,32 @@
"file queue", "file queue",
"ugly queue" "ugly queue"
], ],
"homepage": "https://github.com/dcarbone/ugly-queue", "homepage": "https://hub.cybercinch.nz/cybercinch/ugly-queue",
"license": "GPLv3", "license": "GPLv3",
"authors" : [ "authors" : [
{ {
"name" : "Daniel Carbone", "name" : "Daniel Carbone",
"email" : "daniel.p.carbone@gmail.com" "email" : "daniel.p.carbone@gmail.com"
},
{
"name" : "Aaron Guise",
"email" : "aaron-composer@guise.net.nz"
} }
], ],
"require" : { "require" : {
"php" : ">=5.3.3", "php" : ">=7.1",
"dcarbone/helpers" : "~6.1" "dcarbone/helpers" : "~6.1"
}, },
"require-dev" : { "require-dev" : {
"phpunit/phpunit": "~4.1" "phpunit/phpunit": "~9.6.21"
}, },
"autoload" : { "autoload" : {
"psr-4" : { "psr-4" : {
"DCarbone\\" : "src/" "Cybercinch\\" : "src/"
} }
} }
} }

32
scripts/build.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
mkdir -p ./build/
echo "Made temporary directory"
# Package up the release (Needs to be .zip for upload to gitea)
zip -r "./build/Package.zip" \
. \
-x '.semrel/*' \
-x '.generated-go-semantic-release-changelog.md' \
-x './vendor/*' \
-x './tests/*' \
-x './build/*' \
-x './.git/*' \
-x './.idea/*' \
-x './.github/*' \
-x './scripts/*'
#RELEASE_ID=$(curl --silent -X 'GET' "${GITEA_HOST}/api/v1/repos/cybercinch/ugly-queue/releases/latest" \
#-H "accept: application/json" \
#-H "Authorization: token ${GITEA_TOKEN}" | jq -r .id)
#
## Attach to release
#curl --silent -X 'POST' "${GITEA_HOST}/api/v1/repos/cybercinch/ugly-queue/releases/${RELEASE_ID}/assets?name=ugly-queue-${1}.tar.gz" \
#-H "Authorization: token ${GITEA_TOKEN}" \
#--form attachment="@build/ugly-queue-${1}.tar.gz"
# Upload the artifact to composer registry
curl --user "cibot:${GITEA_TOKEN}" \
--upload-file "build/ugly-queue.zip" \
"${GITEA_HOST}/api/packages/cybercinch/composer?version=${1}"

View File

@@ -1,10 +1,10 @@
<?php namespace DCarbone; <?php namespace Cybercinch;
use DCarbone\Helpers\FileHelper; use DCarbone\Helpers\FileHelper;
/** /**
* Class UglyQueue * Class UglyQueue
* @package DCarbone * @package Cybercinch
*/ */
class UglyQueue implements \Serializable, \SplSubject, \Countable class UglyQueue implements \Serializable, \SplSubject, \Countable
{ {
@@ -269,7 +269,7 @@ class UglyQueue implements \Serializable, \SplSubject, \Countable
$data = array(); $data = array();
$start_line = $lineCount - $count; $start_line = $lineCount - $count;
$i = 0; $i = 0;
while (($line = fscanf($queueFileHandle, "%s\t%s\n")) !== false && $i < $lineCount) while (($line = fscanf($queueFileHandle, "%s\t%[^\n]")) !== false && $i < $lineCount)
{ {
if ($i++ >= $start_line) if ($i++ >= $start_line)
{ {

View File

@@ -1,8 +1,8 @@
<?php namespace DCarbone; <?php namespace Cybercinch;
/** /**
* Class UglyQueueEnum * Class UglyQueueEnum
* @package DCarbone * @package Cybercinch
* *
* Pseudo-enum thing. * Pseudo-enum thing.
*/ */

View File

@@ -1,8 +1,10 @@
<?php namespace DCarbone; <?php namespace Cybercinch;
use InvalidArgumentException;
/** /**
* Class UglyQueueManager * Class UglyQueueManager
* @package DCarbone * @package Cybercinch
*/ */
class UglyQueueManager implements \SplObserver, \Countable class UglyQueueManager implements \SplObserver, \Countable
{ {
@@ -17,12 +19,12 @@ class UglyQueueManager implements \SplObserver, \Countable
* *
* @param string $baseDir * @param string $baseDir
* @throws \RuntimeException * @throws \RuntimeException
* @throws \InvalidArgumentException * @throws InvalidArgumentException
*/ */
public function __construct($baseDir) public function __construct($baseDir)
{ {
if (false === is_string($baseDir)) if (false === is_string($baseDir))
throw new \InvalidArgumentException('Argument 1 expected to be string, "'.gettype($baseDir).'" seen.'); throw new InvalidArgumentException('Argument 1 expected to be string, "'.gettype($baseDir).'" seen.');
if (false === is_dir($baseDir)) if (false === is_dir($baseDir))
throw new \RuntimeException('"'.$baseDir.'" points to a directory that does not exist.'); throw new \RuntimeException('"'.$baseDir.'" points to a directory that does not exist.');
@@ -40,7 +42,7 @@ class UglyQueueManager implements \SplObserver, \Countable
/** /**
* @param string $name * @param string $name
* @return UglyQueue|UglyQueueManager * @return UglyQueue
*/ */
public function getQueue($name) public function getQueue($name)
{ {
@@ -56,7 +58,7 @@ class UglyQueueManager implements \SplObserver, \Countable
/** /**
* @param UglyQueue $uglyQueue * @param UglyQueue $uglyQueue
* @return \DCarbone\UglyQueueManager * @return UglyQueueManager
* @throws \RuntimeException * @throws \RuntimeException
*/ */
public function addQueue(UglyQueue $uglyQueue) public function addQueue(UglyQueue $uglyQueue)
@@ -111,7 +113,7 @@ class UglyQueueManager implements \SplObserver, \Countable
/** /**
* @param UglyQueue $uglyQueue * @param UglyQueue $uglyQueue
* @return \DCarbone\UglyQueueManager * @return UglyQueueManager
*/ */
public function removeQueue(UglyQueue $uglyQueue) public function removeQueue(UglyQueue $uglyQueue)
{ {
@@ -124,7 +126,7 @@ class UglyQueueManager implements \SplObserver, \Countable
/** /**
* @param string $name * @param string $name
* @return \DCarbone\UglyQueueManager * @return UglyQueueManager
*/ */
public function removeQueueByName($name) public function removeQueueByName($name)
{ {
@@ -136,15 +138,15 @@ class UglyQueueManager implements \SplObserver, \Countable
/** /**
* @param string $name * @param string $name
* @return \DCarbone\UglyQueue * @return UglyQueue
* @throws \InvalidArgumentException * @throws InvalidArgumentException
*/ */
public function getQueueWithName($name) public function getQueueWithName($name)
{ {
if (isset($this->queues[$name])) if (isset($this->queues[$name]))
return $this->queues[$name]; return $this->queues[$name];
throw new \InvalidArgumentException('Argument 1 expected to be valid queue name.'); throw new InvalidArgumentException('Argument 1 expected to be valid queue name.');
} }
/** /**

View File

@@ -7,7 +7,7 @@ require_once __DIR__.'/../misc/cleanup.php';
/** /**
* Class UglyQueueTest * Class UglyQueueTest
*/ */
class UglyQueueTest extends PHPUnit_Framework_TestCase class UglyQueueTest extends PHPUnit\Framework\TestCase
{ {
protected $baseDir; protected $baseDir;
@@ -28,45 +28,44 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
'10' => 'Virginia baked ham, sliced', '10' => 'Virginia baked ham, sliced',
); );
protected function setUp() protected function setUp(): void
{ {
$this->baseDir = realpath(__DIR__.'/../misc/queues'); $this->baseDir = realpath(__DIR__.'/../misc/queues');
} }
/** /**
* @covers \DCarbone\UglyQueue::__construct * @covers \Cybercinch\UglyQueue::__construct
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @return \DCarbone\UglyQueue * @return \Cybercinch\UglyQueue
*/ */
public function testCanInitializeObjectWithValidParameters() public function testCanInitializeObjectWithValidParameters()
{ {
$uglyQueue = new \DCarbone\UglyQueue($this->baseDir, 'tasty-sandwich'); $uglyQueue = new \Cybercinch\UglyQueue($this->baseDir, 'tasty-sandwich');
$this->assertInstanceOf('\\DCarbone\\UglyQueue', $uglyQueue); $this->assertInstanceOf('\\Cybercinch\\UglyQueue', $uglyQueue);
return $uglyQueue; return $uglyQueue;
} }
/** /**
* @covers \DCarbone\UglyQueue::retrieveItems * @covers \Cybercinch\UglyQueue::retrieveItems
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @depends testCanInitializeObjectWithValidParameters * @depends testCanInitializeObjectWithValidParameters
* @expectedException \RuntimeException * @param \Cybercinch\UglyQueue $uglyQueue
* @param \DCarbone\UglyQueue $uglyQueue
*/ */
public function testExceptionThrownWhenTryingToProcessQueueAfterInitializationBeforeLock(\DCarbone\UglyQueue $uglyQueue) public function testExceptionThrownWhenTryingToProcessQueueAfterInitializationBeforeLock(\Cybercinch\UglyQueue $uglyQueue)
{ {
$this->expectException(\RuntimeException::class);
$uglyQueue->retrieveItems(); $uglyQueue->retrieveItems();
} }
/** /**
* @covers \DCarbone\UglyQueue::keyExistsInQueue * @covers \Cybercinch\UglyQueue::keyExistsInQueue
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @depends testCanInitializeObjectWithValidParameters * @depends testCanInitializeObjectWithValidParameters
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
*/ */
public function testKeyExistsInQueueReturnsFalseWithEmptyQueueAfterInitialization(\DCarbone\UglyQueue $uglyQueue) public function testKeyExistsInQueueReturnsFalseWithEmptyQueueAfterInitialization(\Cybercinch\UglyQueue $uglyQueue)
{ {
$exists = $uglyQueue->keyExistsInQueue(0); $exists = $uglyQueue->keyExistsInQueue(0);
@@ -75,24 +74,24 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\UglyQueue::addItem * @covers \Cybercinch\UglyQueue::addItem
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @depends testCanInitializeObjectWithValidParameters * @depends testCanInitializeObjectWithValidParameters
* @expectedException \RuntimeException * @param \Cybercinch\UglyQueue $uglyQueue
* @param \DCarbone\UglyQueue $uglyQueue
*/ */
public function testExceptionThrownWhenTryingToAddItemsToQueueWithoutLock(\DCarbone\UglyQueue $uglyQueue) public function testExceptionThrownWhenTryingToAddItemsToQueueWithoutLock(\Cybercinch\UglyQueue $uglyQueue)
{ {
$this->expectException(\RuntimeException::class);
$uglyQueue->addItem('test', 'value'); $uglyQueue->addItem('test', 'value');
} }
/** /**
* @covers \DCarbone\UglyQueue::getPath * @covers \Cybercinch\UglyQueue::getPath
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @depends testCanInitializeObjectWithValidParameters * @depends testCanInitializeObjectWithValidParameters
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
*/ */
public function testCanGetQueueDirectory(\DCarbone\UglyQueue $uglyQueue) public function testCanGetQueueDirectory(\Cybercinch\UglyQueue $uglyQueue)
{ {
$queuePath = $uglyQueue->getPath(); $queuePath = $uglyQueue->getPath();
@@ -100,12 +99,12 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\UglyQueue::getName * @covers \Cybercinch\UglyQueue::getName
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @depends testCanInitializeObjectWithValidParameters * @depends testCanInitializeObjectWithValidParameters
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
*/ */
public function testCanGetQueueName(\DCarbone\UglyQueue $uglyQueue) public function testCanGetQueueName(\Cybercinch\UglyQueue $uglyQueue)
{ {
$queueName = $uglyQueue->getName(); $queueName = $uglyQueue->getName();
@@ -113,33 +112,33 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\UglyQueue::getMode * @covers \Cybercinch\UglyQueue::getMode
* @depends testCanInitializeObjectWithValidParameters * @depends testCanInitializeObjectWithValidParameters
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
*/ */
public function testCanGetQueueMode(\DCarbone\UglyQueue $uglyQueue) public function testCanGetQueueMode(\Cybercinch\UglyQueue $uglyQueue)
{ {
$mode = $uglyQueue->getMode(); $mode = $uglyQueue->getMode();
$this->assertEquals(\DCarbone\UglyQueue::QUEUE_READWRITE, $mode); $this->assertEquals(\Cybercinch\UglyQueue::QUEUE_READWRITE, $mode);
} }
/** /**
* @covers \DCarbone\UglyQueue::getBaseDir * @covers \Cybercinch\UglyQueue::getBaseDir
* @depends testCanInitializeObjectWithValidParameters * @depends testCanInitializeObjectWithValidParameters
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
*/ */
public function testCanGetBaseDirectory(\DCarbone\UglyQueue $uglyQueue) public function testCanGetBaseDirectory(\Cybercinch\UglyQueue $uglyQueue)
{ {
$baseDir = $uglyQueue->getBaseDir(); $baseDir = $uglyQueue->getBaseDir();
$this->assertEquals($this->baseDir, $baseDir); $this->assertEquals($this->baseDir, $baseDir);
} }
/** /**
* @covers \DCarbone\UglyQueue::getLockFile * @covers \Cybercinch\UglyQueue::getLockFile
* @depends testCanInitializeObjectWithValidParameters * @depends testCanInitializeObjectWithValidParameters
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
*/ */
public function testCanGetLockFilePath(\DCarbone\UglyQueue $uglyQueue) public function testCanGetLockFilePath(\Cybercinch\UglyQueue $uglyQueue)
{ {
$lockFile = $uglyQueue->getLockFile(); $lockFile = $uglyQueue->getLockFile();
$this->assertEquals( $this->assertEquals(
@@ -153,11 +152,11 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\UglyQueue::getQueueFile * @covers \Cybercinch\UglyQueue::getQueueFile
* @depends testCanInitializeObjectWithValidParameters * @depends testCanInitializeObjectWithValidParameters
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
*/ */
public function testCanGetQueueFilePath(\DCarbone\UglyQueue $uglyQueue) public function testCanGetQueueFilePath(\Cybercinch\UglyQueue $uglyQueue)
{ {
$queueFile = $uglyQueue->getQueueFile(); $queueFile = $uglyQueue->getQueueFile();
$this->assertEquals( $this->assertEquals(
@@ -171,11 +170,11 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\UglyQueue::getQueueTmpFile * @covers \Cybercinch\UglyQueue::getQueueTmpFile
* @depends testCanInitializeObjectWithValidParameters * @depends testCanInitializeObjectWithValidParameters
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
*/ */
public function testCanGetQueueTmpFilePath(\DCarbone\UglyQueue $uglyQueue) public function testCanGetQueueTmpFilePath(\Cybercinch\UglyQueue $uglyQueue)
{ {
$queueTmpFile = $uglyQueue->getQueueTmpFile(); $queueTmpFile = $uglyQueue->getQueueTmpFile();
$this->assertEquals( $this->assertEquals(
@@ -190,11 +189,11 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\UglyQueue::getSerializeFile * @covers \Cybercinch\UglyQueue::getSerializeFile
* @depends testCanInitializeObjectWithValidParameters * @depends testCanInitializeObjectWithValidParameters
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
*/ */
public function testCanGetSerializeFilePath(\DCarbone\UglyQueue $uglyQueue) public function testCanGetSerializeFilePath(\Cybercinch\UglyQueue $uglyQueue)
{ {
$serializeFile = $uglyQueue->getSerializeFile(); $serializeFile = $uglyQueue->getSerializeFile();
$this->assertEquals( $this->assertEquals(
@@ -209,77 +208,77 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\isAlreadyLocked::isAlreadyLocked * @covers \Cybercinch\isAlreadyLocked::isAlreadyLocked
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @depends testCanInitializeObjectWithValidParameters * @depends testCanInitializeObjectWithValidParameters
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
*/ */
public function testCanGetQueueLockedStatus(\DCarbone\UglyQueue $uglyQueue) public function testCanGetQueueLockedStatus(\Cybercinch\UglyQueue $uglyQueue)
{ {
$locked = $uglyQueue->isAlreadyLocked(); $locked = $uglyQueue->isAlreadyLocked();
$this->assertFalse($locked); $this->assertFalse($locked);
} }
/** /**
* @covers \DCarbone\UglyQueue::count * @covers \Cybercinch\UglyQueue::count
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @depends testCanInitializeObjectWithValidParameters * @depends testCanInitializeObjectWithValidParameters
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
*/ */
public function testGetQueueItemCountReturnsZeroWithEmptyQueue(\DCarbone\UglyQueue $uglyQueue) public function testGetQueueItemCountReturnsZeroWithEmptyQueue(\Cybercinch\UglyQueue $uglyQueue)
{ {
$itemCount = count($uglyQueue); $itemCount = count($uglyQueue);
$this->assertEquals(0, $itemCount); $this->assertEquals(0, $itemCount);
} }
/** /**
* @covers \DCarbone\UglyQueue::__construct * @covers \Cybercinch\UglyQueue::__construct
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @return \DCarbone\UglyQueue * @return \Cybercinch\UglyQueue
*/ */
public function testCanInitializeExistingQueue() public function testCanInitializeExistingQueue()
{ {
$uglyQueue = new \DCarbone\UglyQueue($this->baseDir, 'tasty-sandwich'); $uglyQueue = new \Cybercinch\UglyQueue($this->baseDir, 'tasty-sandwich');
$this->assertInstanceOf('\\DCarbone\\UglyQueue', $uglyQueue); $this->assertInstanceOf('\\Cybercinch\\UglyQueue', $uglyQueue);
return $uglyQueue; return $uglyQueue;
} }
/** /**
* @covers \DCarbone\UglyQueue::lock * @covers \Cybercinch\UglyQueue::lock
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @depends testCanInitializeObjectWithValidParameters * @depends testCanInitializeObjectWithValidParameters
* @expectedException \InvalidArgumentException * @param \Cybercinch\UglyQueue $uglyQueue
* @param \DCarbone\UglyQueue $uglyQueue
*/ */
public function testExceptionThrownWhenPassingNonIntegerValueToLock(\DCarbone\UglyQueue $uglyQueue) public function testExceptionThrownWhenPassingNonIntegerValueToLock(\Cybercinch\UglyQueue $uglyQueue)
{ {
$this->expectException(\InvalidArgumentException::class);
$uglyQueue->lock('7 billion'); $uglyQueue->lock('7 billion');
} }
/** /**
* @covers \DCarbone\UglyQueue::lock * @covers \Cybercinch\UglyQueue::lock
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @depends testCanInitializeObjectWithValidParameters * @depends testCanInitializeObjectWithValidParameters
* @expectedException \InvalidArgumentException * @param \Cybercinch\UglyQueue $uglyQueue
* @param \DCarbone\UglyQueue $uglyQueue
*/ */
public function testExceptionThrownWhenPassingNegativeIntegerValueToLock(\DCarbone\UglyQueue $uglyQueue) public function testExceptionThrownWhenPassingNegativeIntegerValueToLock(\Cybercinch\UglyQueue $uglyQueue)
{ {
$this->expectException(\InvalidArgumentException::class);
$uglyQueue->lock(-73); $uglyQueue->lock(-73);
} }
/** /**
* @covers \DCarbone\UglyQueue::lock * @covers \Cybercinch\UglyQueue::lock
* @covers \DCarbone\isAlreadyLocked::isAlreadyLocked * @covers \Cybercinch\isAlreadyLocked::isAlreadyLocked
* @covers \DCarbone\UglyQueue::createLockFile * @covers \Cybercinch\UglyQueue::createLockFile
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @depends testCanInitializeObjectWithValidParameters * @depends testCanInitializeObjectWithValidParameters
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
* @return \DCarbone\UglyQueue * @return \Cybercinch\UglyQueue
*/ */
public function testCanLockUglyQueueWithDefaultTTL(\DCarbone\UglyQueue $uglyQueue) public function testCanLockUglyQueueWithDefaultTTL(\Cybercinch\UglyQueue $uglyQueue)
{ {
$locked = $uglyQueue->lock(); $locked = $uglyQueue->lock();
@@ -298,13 +297,13 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\UglyQueue::lock * @covers \Cybercinch\UglyQueue::lock
* @covers \DCarbone\isAlreadyLocked::isAlreadyLocked * @covers \Cybercinch\isAlreadyLocked::isAlreadyLocked
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @depends testCanInitializeExistingQueue * @depends testCanInitializeExistingQueue
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
*/ */
public function testCannotLockQueueThatIsAlreadyLocked(\DCarbone\UglyQueue $uglyQueue) public function testCannotLockQueueThatIsAlreadyLocked(\Cybercinch\UglyQueue $uglyQueue)
{ {
$lock = $uglyQueue->lock(); $lock = $uglyQueue->lock();
@@ -313,12 +312,12 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\isAlreadyLocked::isAlreadyLocked * @covers \Cybercinch\isAlreadyLocked::isAlreadyLocked
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @depends testCanLockUglyQueueWithDefaultTTL * @depends testCanLockUglyQueueWithDefaultTTL
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
*/ */
public function testIsLockedReturnsTrueAfterLocking(\DCarbone\UglyQueue $uglyQueue) public function testIsLockedReturnsTrueAfterLocking(\Cybercinch\UglyQueue $uglyQueue)
{ {
$isLocked = $uglyQueue->isAlreadyLocked(); $isLocked = $uglyQueue->isAlreadyLocked();
@@ -326,14 +325,14 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\UglyQueue::unlock * @covers \Cybercinch\UglyQueue::unlock
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @uses \DCarbone\Helpers\FileHelper * @uses \Cybercinch\Helpers\FileHelper
* @depends testCanLockUglyQueueWithDefaultTTL * @depends testCanLockUglyQueueWithDefaultTTL
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
* @return \DCarbone\UglyQueue * @return \Cybercinch\UglyQueue
*/ */
public function testCanUnlockLockedQueue(\DCarbone\UglyQueue $uglyQueue) public function testCanUnlockLockedQueue(\Cybercinch\UglyQueue $uglyQueue)
{ {
$uglyQueue->unlock(); $uglyQueue->unlock();
@@ -344,12 +343,12 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\isAlreadyLocked::isAlreadyLocked * @covers \Cybercinch\isAlreadyLocked::isAlreadyLocked
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @depends testCanUnlockLockedQueue * @depends testCanUnlockLockedQueue
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
*/ */
public function testIsLockedReturnsFalseAfterUnlockingQueue(\DCarbone\UglyQueue $uglyQueue) public function testIsLockedReturnsFalseAfterUnlockingQueue(\Cybercinch\UglyQueue $uglyQueue)
{ {
$isLocked = $uglyQueue->isAlreadyLocked(); $isLocked = $uglyQueue->isAlreadyLocked();
@@ -358,14 +357,14 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\UglyQueue::lock * @covers \Cybercinch\UglyQueue::lock
* @covers \DCarbone\isAlreadyLocked::isAlreadyLocked * @covers \Cybercinch\isAlreadyLocked::isAlreadyLocked
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @uses \DCarbone\Helpers\FileHelper * @uses \Cybercinch\Helpers\FileHelper
* @depends testCanUnlockLockedQueue * @depends testCanUnlockLockedQueue
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
*/ */
public function testIsLockedReturnsFalseWithStaleQueueLockFile(\DCarbone\UglyQueue $uglyQueue) public function testIsLockedReturnsFalseWithStaleQueueLockFile(\Cybercinch\UglyQueue $uglyQueue)
{ {
$uglyQueue->lock(2); $uglyQueue->lock(2);
@@ -379,14 +378,14 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\UglyQueue::lock * @covers \Cybercinch\UglyQueue::lock
* @covers \DCarbone\isAlreadyLocked::isAlreadyLocked * @covers \Cybercinch\isAlreadyLocked::isAlreadyLocked
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @depends testCanUnlockLockedQueue * @depends testCanUnlockLockedQueue
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
* @return \DCarbone\UglyQueue * @return \Cybercinch\UglyQueue
*/ */
public function testCanLockQueueWithValidIntegerValue(\DCarbone\UglyQueue $uglyQueue) public function testCanLockQueueWithValidIntegerValue(\Cybercinch\UglyQueue $uglyQueue)
{ {
$locked = $uglyQueue->lock(200); $locked = $uglyQueue->lock(200);
@@ -406,14 +405,14 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\UglyQueue::addItem * @covers \Cybercinch\UglyQueue::addItem
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @uses \DCarbone\Helpers\FileHelper * @uses \Cybercinch\Helpers\FileHelper
* @depends testCanLockQueueWithValidIntegerValue * @depends testCanLockQueueWithValidIntegerValue
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
* @return \DCarbone\UglyQueue * @return \Cybercinch\UglyQueue
*/ */
public function testCanPopulateQueueTempFileAfterInitializationAndAcquiringLock(\DCarbone\UglyQueue $uglyQueue) public function testCanPopulateQueueTempFileAfterInitializationAndAcquiringLock(\Cybercinch\UglyQueue $uglyQueue)
{ {
foreach(array_reverse($this->tastySandwich, true) as $k=>$v) foreach(array_reverse($this->tastySandwich, true) as $k=>$v)
@@ -426,7 +425,7 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
$uglyQueue->getQueueTmpFile(), $uglyQueue->getQueueTmpFile(),
'queue.tmp file was not created!'); 'queue.tmp file was not created!');
$lineCount = \DCarbone\Helpers\FileHelper::getLineCount($uglyQueue->getQueueTmpFile()); $lineCount = \Dcarbone\Helpers\FileHelper::getLineCount($uglyQueue->getQueueTmpFile());
$this->assertEquals(11, $lineCount); $this->assertEquals(11, $lineCount);
@@ -434,13 +433,13 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\UglyQueue::_populateQueue * @covers \Cybercinch\UglyQueue::_populateQueue
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @depends testCanPopulateQueueTempFileAfterInitializationAndAcquiringLock * @depends testCanPopulateQueueTempFileAfterInitializationAndAcquiringLock
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
* @return \DCarbone\UglyQueue * @return \Cybercinch\UglyQueue
*/ */
public function testCanForciblyUpdateQueueFileFromTempFile(\DCarbone\UglyQueue $uglyQueue) public function testCanForciblyUpdateQueueFileFromTempFile(\Cybercinch\UglyQueue $uglyQueue)
{ {
$uglyQueue->_populateQueue(); $uglyQueue->_populateQueue();
@@ -453,13 +452,13 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\UglyQueue::count * @covers \Cybercinch\UglyQueue::count
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @uses \DCarbone\Helpers\FileHelper * @uses \Cybercinch\Helpers\FileHelper
* @depends testCanPopulateQueueTempFileAfterInitializationAndAcquiringLock * @depends testCanPopulateQueueTempFileAfterInitializationAndAcquiringLock
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
*/ */
public function testCanGetCountOfItemsInPopulatedQueue(\DCarbone\UglyQueue $uglyQueue) public function testCanGetCountOfItemsInPopulatedQueue(\Cybercinch\UglyQueue $uglyQueue)
{ {
$itemCount = count($uglyQueue); $itemCount = count($uglyQueue);
@@ -467,12 +466,12 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\UglyQueue::keyExistsInQueue * @covers \Cybercinch\UglyQueue::keyExistsInQueue
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @depends testCanPopulateQueueTempFileAfterInitializationAndAcquiringLock * @depends testCanPopulateQueueTempFileAfterInitializationAndAcquiringLock
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
*/ */
public function testKeyExistsReturnsTrueWithPopulatedQueue(\DCarbone\UglyQueue $uglyQueue) public function testKeyExistsReturnsTrueWithPopulatedQueue(\Cybercinch\UglyQueue $uglyQueue)
{ {
$exists = $uglyQueue->keyExistsInQueue(5); $exists = $uglyQueue->keyExistsInQueue(5);
@@ -481,41 +480,40 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\UglyQueue::retrieveItems * @covers \Cybercinch\UglyQueue::retrieveItems
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @depends testCanPopulateQueueTempFileAfterInitializationAndAcquiringLock * @depends testCanPopulateQueueTempFileAfterInitializationAndAcquiringLock
* @expectedException \InvalidArgumentException * @param \Cybercinch\UglyQueue $uglyQueue
* @param \DCarbone\UglyQueue $uglyQueue
*/ */
public function testExceptionThrownWhenTryingToProcessLockedQueueWithNonInteger(\DCarbone\UglyQueue $uglyQueue) public function testExceptionThrownWhenTryingToProcessLockedQueueWithNonInteger(\Cybercinch\UglyQueue $uglyQueue)
{ {
$this->expectException(\InvalidArgumentException::class);
$uglyQueue->retrieveItems('Eleventy Billion'); $uglyQueue->retrieveItems('Eleventy Billion');
} }
/** /**
* @covers \DCarbone\UglyQueue::retrieveItems * @covers \Cybercinch\UglyQueue::retrieveItems
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @depends testCanPopulateQueueTempFileAfterInitializationAndAcquiringLock * @depends testCanPopulateQueueTempFileAfterInitializationAndAcquiringLock
* @expectedException \InvalidArgumentException * @expectedException
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
*/ */
public function testExceptionThrownWhenTryingToProcessLockedQueueWithIntegerLessThan1(\DCarbone\UglyQueue $uglyQueue) public function testExceptionThrownWhenTryingToProcessLockedQueueWithIntegerLessThan1(\Cybercinch\UglyQueue $uglyQueue)
{ {
$this->expectException(\InvalidArgumentException::class);
$uglyQueue->retrieveItems(0); $uglyQueue->retrieveItems(0);
} }
/** /**
* @covers \DCarbone\UglyQueue::retrieveItems * @covers \Cybercinch\UglyQueue::retrieveItems
* @covers \DCarbone\UglyQueue::count * @covers \Cybercinch\UglyQueue::count
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @uses \DCarbone\Helpers\FileHelper * @uses \Cybercinch\Helpers\FileHelper
* @depends testCanPopulateQueueTempFileAfterInitializationAndAcquiringLock * @depends testCanPopulateQueueTempFileAfterInitializationAndAcquiringLock
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
* @return \DCarbone\UglyQueue * @return \Cybercinch\UglyQueue
*/ */
public function testCanGetPartialQueueContents(\DCarbone\UglyQueue $uglyQueue) public function testCanGetPartialQueueContents(\Cybercinch\UglyQueue $uglyQueue)
{ {
$process = $uglyQueue->retrieveItems(5); $process = $uglyQueue->retrieveItems(5);
@@ -531,15 +529,15 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\UglyQueue::retrieveItems * @covers \Cybercinch\UglyQueue::retrieveItems
* @covers \DCarbone\UglyQueue::count * @covers \Cybercinch\UglyQueue::count
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @uses \DCarbone\Helpers\FileHelper * @uses \Cybercinch\Helpers\FileHelper
* @depends testCanGetPartialQueueContents * @depends testCanGetPartialQueueContents
* @param \DCarbone\UglyQueue $uglyQueue * @param \Cybercinch\UglyQueue $uglyQueue
* @return \DCarbone\UglyQueue * @return \Cybercinch\UglyQueue
*/ */
public function testCanGetFullQueueContents(\DCarbone\UglyQueue $uglyQueue) public function testCanGetFullQueueContents(\Cybercinch\UglyQueue $uglyQueue)
{ {
$process = $uglyQueue->retrieveItems(6); $process = $uglyQueue->retrieveItems(6);

View File

@@ -3,7 +3,7 @@
/** /**
* Class UglyQueueManagerTest * Class UglyQueueManagerTest
*/ */
class UglyQueueManagerTest extends PHPUnit_Framework_TestCase class UglyQueueManagerTest extends PHPUnit\Framework\TestCase
{ {
protected $baseDir; protected $baseDir;
@@ -13,47 +13,47 @@ class UglyQueueManagerTest extends PHPUnit_Framework_TestCase
'2' => 'boneless pork ribs', '2' => 'boneless pork ribs',
); );
protected function setUp() protected function setUp(): void
{ {
$this->baseDir = realpath(__DIR__.'/../misc/queues'); $this->baseDir = realpath(__DIR__.'/../misc/queues');
} }
/** /**
* @covers \DCarbone\UglyQueueManager::__construct * @covers \Cybercinch\UglyQueueManager::__construct
* @covers \DCarbone\UglyQueue::unserialize * @covers \Cybercinch\UglyQueue::unserialize
* @covers \DCarbone\UglyQueueManager::addQueue * @covers \Cybercinch\UglyQueueManager::addQueue
* @covers \DCarbone\UglyQueueManager::containsQueueWithName * @covers \Cybercinch\UglyQueueManager::containsQueueWithName
* @uses \DCarbone\UglyQueueManager * @uses \Cybercinch\UglyQueueManager
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @return \DCarbone\UglyQueueManager * @return \Cybercinch\UglyQueueManager
*/ */
public function testCanInitializeObjectWithValidPath() public function testCanInitializeObjectWithValidPath()
{ {
$manager = new \DCarbone\UglyQueueManager($this->baseDir); $manager = new \Cybercinch\UglyQueueManager($this->baseDir);
$this->assertInstanceOf('\\DCarbone\\UglyQueueManager', $manager); $this->assertInstanceOf('\\Cybercinch\\UglyQueueManager', $manager);
return $manager; return $manager;
} }
/** /**
* @covers \DCarbone\UglyQueueManager::__construct * @covers \Cybercinch\UglyQueueManager::__construct
* @uses \DCarbone\UglyQueueManager * @uses \Cybercinch\UglyQueueManager
* @expectedException \RuntimeException
*/ */
public function testExceptionThrownDuringConstructionWithInvalidBasePathValue() public function testExceptionThrownDuringConstructionWithInvalidBasePathValue()
{ {
new \DCarbone\UglyQueueManager('i do not exist!'); $this->expectException(RuntimeException::class);
new \Cybercinch\UglyQueueManager('i do not exist!');
} }
/** /**
* @covers \DCarbone\UglyQueueManager::containsQueueWithName * @covers \Cybercinch\UglyQueueManager::containsQueueWithName
* @uses \DCarbone\UglyQueueManager * @uses \Cybercinch\UglyQueueManager
* @depends testCanInitializeObjectWithValidPath * @depends testCanInitializeObjectWithValidPath
* @param \DCarbone\UglyQueueManager $manager * @param \Cybercinch\UglyQueueManager $manager
*/ */
public function testCanDetermineIfValidQueueExistsInManager(\DCarbone\UglyQueueManager $manager) public function testCanDetermineIfValidQueueExistsInManager(\Cybercinch\UglyQueueManager $manager)
{ {
$shouldBeTrue = $manager->containsQueueWithName('tasty-sandwich'); $shouldBeTrue = $manager->containsQueueWithName('tasty-sandwich');
@@ -61,12 +61,12 @@ class UglyQueueManagerTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\UglyQueueManager::containsQueueWithName * @covers \Cybercinch\UglyQueueManager::containsQueueWithName
* @uses \DCarbone\UglyQueueManager * @uses \Cybercinch\UglyQueueManager
* @depends testCanInitializeObjectWithValidPath * @depends testCanInitializeObjectWithValidPath
* @param \DCarbone\UglyQueueManager $manager * @param \Cybercinch\UglyQueueManager $manager
*/ */
public function testCanDetermineQueueDoesNotExistInManager(\DCarbone\UglyQueueManager $manager) public function testCanDetermineQueueDoesNotExistInManager(\Cybercinch\UglyQueueManager $manager)
{ {
$shouldBeFalse = $manager->containsQueueWithName('i should not exist'); $shouldBeFalse = $manager->containsQueueWithName('i should not exist');
@@ -74,95 +74,95 @@ class UglyQueueManagerTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @covers \DCarbone\UglyQueueManager::getQueueWithName * @covers \Cybercinch\UglyQueueManager::getQueueWithName
* @uses \DCarbone\UglyQueueManager * @uses \Cybercinch\UglyQueueManager
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @depends testCanInitializeObjectWithValidPath * @depends testCanInitializeObjectWithValidPath
* @param \DCarbone\UglyQueueManager $manager * @param \Cybercinch\UglyQueueManager $manager
*/ */
public function testCanGetUglyQueueObjectFromManager(\DCarbone\UglyQueueManager $manager) public function testCanGetUglyQueueObjectFromManager(\Cybercinch\UglyQueueManager $manager)
{ {
$uglyQueue = $manager->getQueueWithName('tasty-sandwich'); $uglyQueue = $manager->getQueueWithName('tasty-sandwich');
$this->assertInstanceOf('\\DCarbone\\UglyQueue', $uglyQueue); $this->assertInstanceOf('\\Cybercinch\\UglyQueue', $uglyQueue);
$this->assertEquals('tasty-sandwich', $uglyQueue->getName()); $this->assertEquals('tasty-sandwich', $uglyQueue->getName());
} }
/** /**
* @covers \DCarbone\UglyQueueManager::getQueueWithName * @covers \Cybercinch\UglyQueueManager::getQueueWithName
* @uses \DCarbone\UglyQueueManager * @uses \Cybercinch\UglyQueueManager
* @expectedException \InvalidArgumentException
* @depends testCanInitializeObjectWithValidPath * @depends testCanInitializeObjectWithValidPath
* @param \DCarbone\UglyQueueManager $manager * @param \Cybercinch\UglyQueueManager $manager
*/ */
public function testExceptionThrownWhenTryingToGetNonExistentQueueFromManager(\DCarbone\UglyQueueManager $manager) public function testExceptionThrownWhenTryingToGetNonExistentQueueFromManager(\Cybercinch\UglyQueueManager $manager)
{ {
$this->expectException(InvalidArgumentException::class);
$manager->getQueueWithName('sandwiches'); $manager->getQueueWithName('sandwiches');
} }
/** /**
* @covers \DCarbone\UglyQueueManager::getQueueList * @covers \Cybercinch\UglyQueueManager::getQueueList
* @uses \DCarbone\UglyQueueManager * @uses \Cybercinch\UglyQueueManager
* @depends testCanInitializeObjectWithValidPath * @depends testCanInitializeObjectWithValidPath
* @param \DCarbone\UglyQueueManager $manager * @param \Cybercinch\UglyQueueManager $manager
*/ */
public function testCanGetListOfQueuesInManager(\DCarbone\UglyQueueManager $manager) public function testCanGetListOfQueuesInManager(\Cybercinch\UglyQueueManager $manager)
{ {
$queueList = $manager->getQueueList(); $queueList = $manager->getQueueList();
$this->assertInternalType('array', $queueList); $this->assertIsArray($queueList);
$this->assertCount(1, $queueList); $this->assertCount(1, $queueList);
$this->assertContains('tasty-sandwich', $queueList); $this->assertContains('tasty-sandwich', $queueList);
} }
/** /**
* @covers \DCarbone\UglyQueueManager::getQueueWithName * @covers \Cybercinch\UglyQueueManager::getQueueWithName
* @covers \DCarbone\UglyQueueManager::addQueue * @covers \Cybercinch\UglyQueueManager::addQueue
* @uses \DCarbone\UglyQueueManager * @uses \Cybercinch\UglyQueueManager
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @expectedException \RuntimeException
* @depends testCanInitializeObjectWithValidPath * @depends testCanInitializeObjectWithValidPath
* @param \DCarbone\UglyQueueManager $manager * @param \Cybercinch\UglyQueueManager $manager
*/ */
public function testExceptionThrownWhenReAddingQueueToManager(\DCarbone\UglyQueueManager $manager) public function testExceptionThrownWhenReAddingQueueToManager(\Cybercinch\UglyQueueManager $manager)
{ {
$this->expectException(RuntimeException::class);
$uglyQueue = $manager->getQueueWithName('tasty-sandwich'); $uglyQueue = $manager->getQueueWithName('tasty-sandwich');
$manager->addQueue($uglyQueue); $manager->addQueue($uglyQueue);
} }
/** /**
* @covers \DCarbone\UglyQueueManager::addQueueAtPath * @covers \Cybercinch\UglyQueueManager::addQueueAtPath
* @covers \DCarbone\UglyQueueManager::addQueue * @covers \Cybercinch\UglyQueueManager::addQueue
* @covers \DCarbone\UglyQueueManager::getQueueWithName * @covers \Cybercinch\UglyQueueManager::getQueueWithName
* @uses \DCarbone\UglyQueueManager * @uses \Cybercinch\UglyQueueManager
* @uses \DCarbone\UglyQueue * @uses \Cybercinch\UglyQueue
* @depends testCanInitializeObjectWithValidPath * @depends testCanInitializeObjectWithValidPath
* @param \DCarbone\UglyQueueManager $manager * @param \Cybercinch\UglyQueueManager $manager
*/ */
public function testCanInitializeNewQueueAndAddToManager(\DCarbone\UglyQueueManager $manager) public function testCanInitializeNewQueueAndAddToManager(\Cybercinch\UglyQueueManager $manager)
{ {
$manager->addQueueAtPath($this->baseDir.'/really-tasty-sandwich'); $manager->addQueueAtPath($this->baseDir.'/really-tasty-sandwich');
$uglyQueue = $manager->getQueueWithName('really-tasty-sandwich'); $uglyQueue = $manager->getQueueWithName('really-tasty-sandwich');
$this->assertInstanceOf('\\DCarbone\\UglyQueue', $uglyQueue); $this->assertInstanceOf('\\Cybercinch\\UglyQueue', $uglyQueue);
$this->assertEquals('really-tasty-sandwich', $uglyQueue->getName()); $this->assertEquals('really-tasty-sandwich', $uglyQueue->getName());
$queueList = $manager->getQueueList(); $queueList = $manager->getQueueList();
$this->assertInternalType('array', $queueList); $this->assertIsArray($queueList);
$this->assertCount(2, $queueList); $this->assertCount(2, $queueList);
$this->assertContains('really-tasty-sandwich', $queueList); $this->assertContains('really-tasty-sandwich', $queueList);
} }
/** /**
* @covers \DCarbone\UglyQueueManager::removeQueueByName * @covers \Cybercinch\UglyQueueManager::removeQueueByName
* @uses \DCarbone\UglyQueueManager * @uses \Cybercinch\UglyQueueManager
* @depends testCanInitializeObjectWithValidPath * @depends testCanInitializeObjectWithValidPath
* @param \DCarbone\UglyQueueManager $manager * @param \Cybercinch\UglyQueueManager $manager
*/ */
public function testCanRemoveQueueFromManagerByName(\DCarbone\UglyQueueManager $manager) public function testCanRemoveQueueFromManagerByName(\Cybercinch\UglyQueueManager $manager)
{ {
$manager->removeQueueByName('really-tasty-sandwich'); $manager->removeQueueByName('really-tasty-sandwich');
@@ -173,12 +173,12 @@ class UglyQueueManagerTest extends PHPUnit_Framework_TestCase
} }
// /** // /**
// * @covers \DCarbone\UglyQueue::queueExists // * @covers \Cybercinch\UglyQueue::queueExists
// * @uses \DCarbone\UglyQueue // * @uses \Cybercinch\UglyQueue
// * @depends testCanInitializeNewUglyQueue // * @depends testCanInitializeNewUglyQueue
// * @param \DCarbone\UglyQueue $uglyQueue // * @param \Cybercinch\UglyQueue $uglyQueue
// */ // */
// public function testCanDetermineExistenceOfExistingQueue(\DCarbone\UglyQueue $uglyQueue) // public function testCanDetermineExistenceOfExistingQueue(\Cybercinch\UglyQueue $uglyQueue)
// { // {
// $exists = $uglyQueue->queueExists('tasty-sandwich'); // $exists = $uglyQueue->queueExists('tasty-sandwich');
// //
@@ -186,12 +186,12 @@ class UglyQueueManagerTest extends PHPUnit_Framework_TestCase
// } // }
// //
// /** // /**
// * @covers \DCarbone\UglyQueue::queueExists // * @covers \Cybercinch\UglyQueue::queueExists
// * @uses \DCarbone\UglyQueue // * @uses \Cybercinch\UglyQueue
// * @depends testCanInitializeNewUglyQueue // * @depends testCanInitializeNewUglyQueue
// * @param \DCarbone\UglyQueue $uglyQueue // * @param \Cybercinch\UglyQueue $uglyQueue
// */ // */
// public function testCanDetermineExistenceOfNonExistingQueue(\DCarbone\UglyQueue $uglyQueue) // public function testCanDetermineExistenceOfNonExistingQueue(\Cybercinch\UglyQueue $uglyQueue)
// { // {
// $exists = $uglyQueue->queueExists('nasty-sandwich'); // $exists = $uglyQueue->queueExists('nasty-sandwich');
// //
@@ -199,12 +199,12 @@ class UglyQueueManagerTest extends PHPUnit_Framework_TestCase
// } // }
// //
// /** // /**
// * @covers \DCarbone\UglyQueue::getInitializedQueueList // * @covers \Cybercinch\UglyQueue::getInitializedQueueList
// * @uses \DCarbone\UglyQueue // * @uses \Cybercinch\UglyQueue
// * @depends testCanInitializeNewUglyQueue // * @depends testCanInitializeNewUglyQueue
// * @param \DCarbone\UglyQueue $uglyQueue // * @param \Cybercinch\UglyQueue $uglyQueue
// */ // */
// public function testCanGetListOfInitializedQueues(\DCarbone\UglyQueue $uglyQueue) // public function testCanGetListOfInitializedQueues(\Cybercinch\UglyQueue $uglyQueue)
// { // {
// $queueList = $uglyQueue->getInitializedQueueList(); // $queueList = $uglyQueue->getInitializedQueueList();
// //