Skip to content

Commit cbf6256

Browse files
author
Eugene Leonovich
committed
Rename statistics to stats
1 parent 7eab6de commit cbf6256

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,11 @@ section of the [queue's README](https://github.com/tarantool/queue/blob/master/R
185185

186186
### Statistics
187187

188-
The `statistics()` method provides access to the statistical information accumulated
188+
The `stats()` method provides access to the statistical information accumulated
189189
since a queue was created:
190190

191191
```php
192-
$stat = $queue->statistics();
192+
$stats = $queue->stats();
193193
```
194194

195195
The result of this call might look like this:
@@ -216,8 +216,8 @@ The result of this call might look like this:
216216
In addition, you can specify a key to return only a subset of the array:
217217

218218
```php
219-
$calls = $queue->statistics('calls');
220-
$total = $queue->statistics('tasks.total');
219+
$calls = $queue->stats('calls');
220+
$total = $queue->stats('tasks.total');
221221
```
222222

223223

src/Queue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ public function truncate()
137137
*
138138
* @throws \InvalidArgumentException
139139
*/
140-
public function statistics($path = null)
140+
public function stats($path = null)
141141
{
142-
$result = $this->client->call('queue.statistics', [$this->tubeName]);
142+
$result = $this->client->call('queue.stats', [$this->tubeName]);
143143

144144
if (null === $path) {
145145
return $result[0][0];

tests/Integration/QueueTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -189,20 +189,20 @@ public function testDelete()
189189
*/
190190
public function testTruncate()
191191
{
192-
$this->assertSame(2, $this->queue->statistics('tasks.total'));
192+
$this->assertSame(2, $this->queue->stats('tasks.total'));
193193

194194
$this->queue->truncate();
195195

196-
$this->assertSame(0, $this->queue->statistics('tasks.total'));
196+
$this->assertSame(0, $this->queue->stats('tasks.total'));
197197
}
198198

199199
public function testTruncateEmpty()
200200
{
201-
$this->assertSame(0, $this->queue->statistics('tasks.total'));
201+
$this->assertSame(0, $this->queue->stats('tasks.total'));
202202

203203
$this->queue->truncate();
204204

205-
$this->assertSame(0, $this->queue->statistics('tasks.total'));
205+
$this->assertSame(0, $this->queue->stats('tasks.total'));
206206
}
207207

208208
/**
@@ -221,9 +221,9 @@ public function testTruncateEmpty()
221221
* @eval queue.tube['%tube_name%']:kick(1)
222222
* @eval queue.tube['%tube_name%']:take(.001)
223223
*/
224-
public function testStatistics()
224+
public function testStats()
225225
{
226-
$stat = $this->queue->statistics();
226+
$stats = $this->queue->stats();
227227

228228
$this->assertEquals([
229229
'tasks' => [
@@ -243,12 +243,12 @@ public function testStatistics()
243243
'put' => 5,
244244
'bury' => 2,
245245
],
246-
], $stat, '', 0.0, 3, true);
246+
], $stats, '', 0.0, 3, true);
247247
}
248248

249-
public function testStatisticsIsEmpty()
249+
public function testEmptyStats()
250250
{
251-
$stat = $this->queue->statistics();
251+
$stats = $this->queue->stats();
252252

253253
$this->assertEquals([
254254
'tasks' => [
@@ -268,7 +268,7 @@ public function testStatisticsIsEmpty()
268268
'release' => 0,
269269
'take' => 0,
270270
],
271-
], $stat);
271+
], $stats);
272272
}
273273

274274
/**

tests/Integration/Ttl.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ public function testDelayedRelease()
9191
* @eval queue.tube['%tube_name%']:put('stat_delayed_0', {delay = 9999})
9292
* @eval queue.tube['%tube_name%']:put('stat_delayed_1', {delay = 9999})
9393
*/
94-
public function testStatisticsDelayed()
94+
public function testStatsDelayed()
9595
{
96-
$count = $this->queue->statistics('tasks.delayed');
96+
$count = $this->queue->stats('tasks.delayed');
9797

9898
$this->assertSame(2, $count);
9999
}

tests/Unit/QueueTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,22 +99,22 @@ public function testTruncate()
9999
}
100100

101101
/**
102-
* @dataProvider provideStatisticsData
102+
* @dataProvider provideStatsData
103103
*/
104-
public function testStatistics(array $stats, $expectedResult, $path = null)
104+
public function testStats(array $stats, $expectedResult, $path = null)
105105
{
106106
$this->client->expects($this->once())->method('call')
107-
->with('queue.statistics')
107+
->with('queue.stats')
108108
->willReturn([[$stats]]);
109109

110110
$actualResult = 3 === func_num_args()
111-
? $this->queue->statistics($path)
112-
: $this->queue->statistics();
111+
? $this->queue->stats($path)
112+
: $this->queue->stats();
113113

114114
$this->assertSame($expectedResult, $actualResult);
115115
}
116116

117-
public function provideStatisticsData()
117+
public function provideStatsData()
118118
{
119119
return [
120120
[self::$stats, self::$stats],
@@ -137,20 +137,20 @@ public function provideStatisticsData()
137137
}
138138

139139
/**
140-
* @dataProvider provideStatisticsInvalidPath
140+
* @dataProvider provideStatsInvalidPath
141141
* @expectedException \InvalidArgumentException
142142
* @expectedExceptionMessageRegExp /^Invalid path ".*?"\.$/
143143
*/
144-
public function testStatisticsInvalidPath($path)
144+
public function testStatsInvalidPath($path)
145145
{
146146
$this->client->expects($this->once())->method('call')
147-
->with('queue.statistics')
147+
->with('queue.stats')
148148
->willReturn([[self::$stats]]);
149149

150-
$this->queue->statistics($path);
150+
$this->queue->stats($path);
151151
}
152152

153-
public function provideStatisticsInvalidPath()
153+
public function provideStatsInvalidPath()
154154
{
155155
return [
156156
[''],

0 commit comments

Comments
 (0)