StaffDirectoryTest::testGetStaffMembers()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 14
rs 10
1
<?php
2
3
namespace Dynamic\Staff\Tests\Pages;
4
5
use Dynamic\Staff\Pages\StaffDirectory;
6
use Dynamic\Staff\Pages\StaffMember;
7
use SilverStripe\Dev\SapphireTest;
8
use SilverStripe\ORM\DataList;
9
10
/**
11
 * Class StaffDirectoryTest
12
 * @package Dynamic\Staff\Tests\Pages
13
 */
14
class StaffDirectoryTest extends SapphireTest
15
{
16
17
    /**
18
     * @var string
19
     */
20
    protected static $fixture_file = '../fixtures.yml';
21
22
    /**
23
     * Tests getStaffMembers()
24
     */
25
    public function testGetStaffMembers()
26
    {
27
        /** @var StaffDirectory $directory */
28
        $directory = $this->objFromFixture(StaffDirectory::class, 'default');
29
        /** @var StaffMember $one */
30
        $one = $this->objFromFixture(StaffMember::class, 'one');
0 ignored issues
show
Unused Code introduced by
The assignment to $one is dead and can be removed.
Loading history...
31
        /** @var StaffMember $two */
32
        $two = $this->objFromFixture(StaffMember::class, 'two');
0 ignored issues
show
Unused Code introduced by
The assignment to $two is dead and can be removed.
Loading history...
33
        /** @var StaffMember $three */
34
        $three = $this->objFromFixture(StaffMember::class, 'three');
0 ignored issues
show
Unused Code introduced by
The assignment to $three is dead and can be removed.
Loading history...
35
36
        $staff = $directory->getStaffMembers();
37
        $this->assertInstanceOf(DataList::class, $staff);
38
        $this->assertEquals(3, $staff->count());
39
    }
40
}
41