CounterTest::a_counter_can_seed_simple_test()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 9
c 2
b 0
f 0
dl 0
loc 15
rs 9.9666
cc 1
nc 1
nop 0
1
<?php
2
namespace Turahe\Counters\Tests;
3
4
use Turahe\Counters\Models\Counter;
5
6
class CounterTest extends TestCase
7
{
8
    /** @test */
9
    public function a_counter_can_seed_simple_test()
10
    {
11
        // create Counters
12
        //This will create a counter with inital value as 3, and every increment 5 will be added.
13
        $counter = Counter::create([
14
            'key'           => 'number_of_downloads',
15
            'name'          => 'Visitors',
16
            'initial_value' => 3,
17
            'step'          => 5,
18
        ]);
19
20
        $this->assertEquals('number_of_downloads', $counter->key);
21
        $this->assertEquals('Visitors', $counter->name);
22
        $this->assertEquals(3, $counter->initial_value);
23
        $this->assertEquals(5, $counter->step);
24
    }
25
    /** @test */
26
    public function a_create_name_key_only()
27
    {
28
        $counter = Counter::create([
29
            'key'  => 'number_of_downloads',
30
            'name' => 'Visitors',
31
        ]);
32
33
        $this->assertEquals('number_of_downloads', $counter->key);
34
        $this->assertEquals('Visitors', $counter->name);
35
    }
36
}
37