CounterTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 15
c 2
b 0
f 0
dl 0
loc 29
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A a_counter_can_seed_simple_test() 0 15 1
A a_create_name_key_only() 0 9 1
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