Completed
Push — master ( d19955...af891e )
by Sam
22s
created

PopoverFieldTest::testPopoverField()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 14
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 21
rs 9.3142
1
<?php
2
3
class PopoverFieldTest extends SapphireTest
4
{
5
	public function testPopoverField() {
6
		// Test normal constructor
7
		$field = new PopoverField('My Title', [
8
			new TextField('Name')
9
		]);
10
		$field->setPopoverTitle('Popover Title');
11
		$this->assertEquals('My Title', $field->Title());
12
		$this->assertEquals('Popover Title', $field->getPopoverTitle());
13
		$this->assertEquals('Name', $field->getChildren()->first()->Title());
14
15
		// Test single array argument
16
		$field2 = new PopoverField([ new TextField('Other')]);
17
		$this->assertEmpty($field2->Title());
18
		$this->assertEquals('Other', $field2->getChildren()->first()->Title());
19
20
		// Test variable length constructor
21
		$field3 = new PopoverField('Field Title', new TextField('First'), new TextField('Second'));
22
		$this->assertEquals('Field Title', $field3->Title());
23
		$this->assertEquals('First', $field3->getChildren()->first()->Title());
24
		$this->assertEquals('Second', $field3->getChildren()->last()->Title());
25
	}
26
}
27