Completed
Push — master ( 38e886...df2920 )
by Oleg
04:55
created

TraitsTest::testGetAttributesCallback()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

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