From cbf625645e8090c57815d3308d05ced3ff6f55a1 Mon Sep 17 00:00:00 2001 From: Eugene Leonovich Date: Thu, 30 Jun 2016 10:52:17 +0200 Subject: [PATCH] Rename statistics to stats --- README.md | 8 ++++---- src/Queue.php | 4 ++-- tests/Integration/QueueTest.php | 20 ++++++++++---------- tests/Integration/Ttl.php | 4 ++-- tests/Unit/QueueTest.php | 22 +++++++++++----------- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index d99c724..7dd8aae 100644 --- a/README.md +++ b/README.md @@ -185,11 +185,11 @@ section of the [queue's README](https://github.com/tarantool/queue/blob/master/R ### Statistics -The `statistics()` method provides access to the statistical information accumulated +The `stats()` method provides access to the statistical information accumulated since a queue was created: ```php -$stat = $queue->statistics(); +$stats = $queue->stats(); ``` The result of this call might look like this: @@ -216,8 +216,8 @@ The result of this call might look like this: In addition, you can specify a key to return only a subset of the array: ```php -$calls = $queue->statistics('calls'); -$total = $queue->statistics('tasks.total'); +$calls = $queue->stats('calls'); +$total = $queue->stats('tasks.total'); ``` diff --git a/src/Queue.php b/src/Queue.php index 0f7e76b..db9560f 100644 --- a/src/Queue.php +++ b/src/Queue.php @@ -137,9 +137,9 @@ public function truncate() * * @throws \InvalidArgumentException */ - public function statistics($path = null) + public function stats($path = null) { - $result = $this->client->call('queue.statistics', [$this->tubeName]); + $result = $this->client->call('queue.stats', [$this->tubeName]); if (null === $path) { return $result[0][0]; diff --git a/tests/Integration/QueueTest.php b/tests/Integration/QueueTest.php index 352ad2f..2224e43 100644 --- a/tests/Integration/QueueTest.php +++ b/tests/Integration/QueueTest.php @@ -189,20 +189,20 @@ public function testDelete() */ public function testTruncate() { - $this->assertSame(2, $this->queue->statistics('tasks.total')); + $this->assertSame(2, $this->queue->stats('tasks.total')); $this->queue->truncate(); - $this->assertSame(0, $this->queue->statistics('tasks.total')); + $this->assertSame(0, $this->queue->stats('tasks.total')); } public function testTruncateEmpty() { - $this->assertSame(0, $this->queue->statistics('tasks.total')); + $this->assertSame(0, $this->queue->stats('tasks.total')); $this->queue->truncate(); - $this->assertSame(0, $this->queue->statistics('tasks.total')); + $this->assertSame(0, $this->queue->stats('tasks.total')); } /** @@ -221,9 +221,9 @@ public function testTruncateEmpty() * @eval queue.tube['%tube_name%']:kick(1) * @eval queue.tube['%tube_name%']:take(.001) */ - public function testStatistics() + public function testStats() { - $stat = $this->queue->statistics(); + $stats = $this->queue->stats(); $this->assertEquals([ 'tasks' => [ @@ -243,12 +243,12 @@ public function testStatistics() 'put' => 5, 'bury' => 2, ], - ], $stat, '', 0.0, 3, true); + ], $stats, '', 0.0, 3, true); } - public function testStatisticsIsEmpty() + public function testEmptyStats() { - $stat = $this->queue->statistics(); + $stats = $this->queue->stats(); $this->assertEquals([ 'tasks' => [ @@ -268,7 +268,7 @@ public function testStatisticsIsEmpty() 'release' => 0, 'take' => 0, ], - ], $stat); + ], $stats); } /** diff --git a/tests/Integration/Ttl.php b/tests/Integration/Ttl.php index 630bc8d..bdea4ec 100644 --- a/tests/Integration/Ttl.php +++ b/tests/Integration/Ttl.php @@ -91,9 +91,9 @@ public function testDelayedRelease() * @eval queue.tube['%tube_name%']:put('stat_delayed_0', {delay = 9999}) * @eval queue.tube['%tube_name%']:put('stat_delayed_1', {delay = 9999}) */ - public function testStatisticsDelayed() + public function testStatsDelayed() { - $count = $this->queue->statistics('tasks.delayed'); + $count = $this->queue->stats('tasks.delayed'); $this->assertSame(2, $count); } diff --git a/tests/Unit/QueueTest.php b/tests/Unit/QueueTest.php index c8f6663..5eae590 100644 --- a/tests/Unit/QueueTest.php +++ b/tests/Unit/QueueTest.php @@ -99,22 +99,22 @@ public function testTruncate() } /** - * @dataProvider provideStatisticsData + * @dataProvider provideStatsData */ - public function testStatistics(array $stats, $expectedResult, $path = null) + public function testStats(array $stats, $expectedResult, $path = null) { $this->client->expects($this->once())->method('call') - ->with('queue.statistics') + ->with('queue.stats') ->willReturn([[$stats]]); $actualResult = 3 === func_num_args() - ? $this->queue->statistics($path) - : $this->queue->statistics(); + ? $this->queue->stats($path) + : $this->queue->stats(); $this->assertSame($expectedResult, $actualResult); } - public function provideStatisticsData() + public function provideStatsData() { return [ [self::$stats, self::$stats], @@ -137,20 +137,20 @@ public function provideStatisticsData() } /** - * @dataProvider provideStatisticsInvalidPath + * @dataProvider provideStatsInvalidPath * @expectedException \InvalidArgumentException * @expectedExceptionMessageRegExp /^Invalid path ".*?"\.$/ */ - public function testStatisticsInvalidPath($path) + public function testStatsInvalidPath($path) { $this->client->expects($this->once())->method('call') - ->with('queue.statistics') + ->with('queue.stats') ->willReturn([[self::$stats]]); - $this->queue->statistics($path); + $this->queue->stats($path); } - public function provideStatisticsInvalidPath() + public function provideStatsInvalidPath() { return [ [''],