Passed
Push — zero-is-false ( 14c39e...85b8a2 )
by Sam
06:15
created

CurrencyFieldDisabledTest::testFieldWithValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SilverStripe\Forms\Tests;
4
5
use SilverStripe\Dev\SapphireTest;
6
use SilverStripe\Forms\CurrencyField_Disabled;
7
use SilverStripe\ORM\FieldType\DBCurrency;
8
9
class CurrencyFieldDisabledTest extends SapphireTest
10
{
11
    public function testFieldWithValue()
12
    {
13
        $field = new CurrencyField_Disabled('Test', '', '$5.00');
14
        $result = $field->Field();
15
16
        $this->assertContains('<input', $result, 'An input should be rendered');
17
        $this->assertContains('disabled', $result, 'The input should be disabled');
18
        $this->assertContains('$5.00', $result, 'The value should be rendered');
19
    }
20
21
    /**
22
     * @todo: Update the expectation when intl for currencies is implemented
23
     */
24
    public function testFieldWithCustomisedCurrencySymbol()
25
    {
26
        DBCurrency::config()->update('currency_symbol', '€');
27
        $field = new CurrencyField_Disabled('Test', '', '€5.00');
28
        $result = $field->Field();
29
30
        $this->assertContains('<input', $result, 'An input should be rendered');
31
        $this->assertContains('disabled', $result, 'The input should be disabled');
32
        $this->assertContains('€5.00', $result, 'The value should be rendered');
33
    }
34
}
35