Completed
Push — master ( 79027c...8f1f38 )
by Oleg
03:47
created

TraitsTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 18
rs 10
c 1
b 0
f 0
wmc 1
lcom 1
cbo 3
1
<?php
2
namespace Malezha\Menu\Tests;
3
4
use Malezha\Menu\Contracts\Attributes;
5
use Malezha\Menu\Factory\LinkFactory;
6
7
/**
8
 * Class TraitsTest
9
 * @package Malezha\Menu\Tests
10
 */
11
class TraitsTest extends TestCase
12
{
13
    public function testGetAttributesCallback()
14
    {
15
        $factory = (new LinkFactory($this->app));
16
        $factory->attributes = $this->app->makeWith(Attributes::class, ['attributes' => [
17
            'class' => 'color-red',
18
        ]]);
19
        $link = $factory->build();
20
        
21
        $hasClass = $link->getAttributes(function($attributes) {
22
            $this->assertInstanceOf(Attributes::class, $attributes);
23
            return $attributes->has('class');
24
        });
25
        
26
        $this->assertTrue($hasClass);
27
    }
28
}