for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace AntonyThorpe\Knockout\Tests;
use SilverStripe\Dev\SapphireTest;
use AntonyThorpe\Knockout\KnockoutTextField;
/**
* KnockoutTextFieldTest
*/
class KnockoutTextFieldTest extends SapphireTest
{
public function testKnockoutTextField()
$field = KnockoutTextField::create("MyField", "My Field", null, 50)
->setObservable('spaceship')
->setBindingType('value')
->setOtherBindings("valueUpdate: 'input'")
->setHasFocus(true);
$this->assertEquals(
"spaceship",
$field->getObservable(),
"observable is set"
);
"valueUpdate: 'input'",
$field->getOtherBindings(),
"other bindings are set"
"value",
$field->getBindingType(),
"Binding Type is set"
$field->setBindingType('textInput');
"textInput",
"Binding Type is reset"
$this->assertTrue(
$field->getHasFocus(),
"Focus is set to True"
}