for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
class AutoCompleteOptionTest extends ElasticsearchBaseTest {
public function setUp() {
$this->AutoCompleteOption = new AutoCompleteOption();
AutoCompleteOption
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
parent::setUp();
}
public function testCanCreate() {
$this->assertFalse($this->AutoCompleteOption->can_create(), 'CMS users should not be able to
create this');
public function testCanDelete() {
$this->assertFalse($this->AutoCompleteOption->can_delete(), 'CMS users should not be able to
delete this');
public function testCanEdit() {
$this->assertFalse($this->AutoCompleteOption->can_edit(), 'CMS users should not be able to
edit this');
/*
Check that requireDefaultRecords only creates 3 options
- similar
- search
- go to record
*/
public function testRequireDefaultRecords() {
$this->AutoCompleteOption->requireDefaultRecords();
$similar = AutoCompleteOption::get()->filter('Name','Similar')->first();
$this->assertEquals(1, $similar->ID);
$search = AutoCompleteOption::get()->filter('Name','Search')->first();
$this->assertEquals(2, $search->ID);
$goto = AutoCompleteOption::get()->filter('Name','GoToRecord')->first();
$this->assertEquals(3, $goto->ID);
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: