summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/test/lib/Elastica/Test/Cluster/Health/ShardTest.php
blob: 5a436623ca876c928e8cbda652dcb6725815455d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
namespace Elastica\Test\Cluster\Health;

use Elastica\Cluster\Health\Shard as HealthShard;
use Elastica\Test\Base as BaseTest;

class ShardTest extends BaseTest
{
    /**
     * @var \Elastica\Cluster\Health\Shard
     */
    protected $_shard;

    public function setUp()
    {
        parent::setUp();

        $shardData = array(
            'status' => 'red',
            'primary_active' => true,
            'active_shards' => 1,
            'relocating_shards' => 0,
            'initializing_shards' => 0,
            'unassigned_shards' => 1,
        );

        $this->_shard = new HealthShard(2, $shardData);
    }

    /**
     * @group unit
     */
    public function testGetShardNumber()
    {
        $this->assertEquals(2, $this->_shard->getShardNumber());
    }

    /**
     * @group unit
     */
    public function testGetStatus()
    {
        $this->assertEquals('red', $this->_shard->getStatus());
    }

    /**
     * @group unit
     */
    public function testisPrimaryActive()
    {
        $this->assertTrue($this->_shard->isPrimaryActive());
    }

    /**
     * @group unit
     */
    public function testIsActive()
    {
        $this->assertTrue($this->_shard->isActive());
    }

    /**
     * @group unit
     */
    public function testIsRelocating()
    {
        $this->assertFalse($this->_shard->isRelocating());
    }

    /**
     * @group unit
     */
    public function testIsInitialized()
    {
        $this->assertFalse($this->_shard->isInitialized());
    }

    /**
     * @group unit
     */
    public function testIsUnassigned()
    {
        $this->assertTrue($this->_shard->isUnassigned());
    }
}