Test Failed
Push — master ( 3a2408...8f3679 )
by Nur
03:38
created

CounterTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

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