| Conditions | 1 |
| Paths | 1 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 1 |
| 1 | <?php |
||
| 9 | 1 | public function testCMSFields() { |
|
| 10 | 1 | $sc = new SearchableClass(); |
|
| 11 | 1 | $sc->Name = 'TestField'; |
|
|
|
|||
| 12 | 1 | $sc->InSiteTree = false; |
|
| 13 | 1 | $sc->write(); |
|
| 14 | |||
| 15 | 1 | $fields = $sc->getCMSFields(); |
|
| 16 | |||
| 17 | 1 | $tab = $this->checkTabExists($fields,'Main'); |
|
| 18 | |||
| 19 | //Check fields |
||
| 20 | 1 | $nf = $this->checkFieldExists($tab, 'Name'); |
|
| 21 | 1 | $this->assertTrue($nf->isDisabled()); |
|
| 22 | |||
| 23 | //FIXME - why does this fail? |
||
| 24 | 1 | $this->assertTrue($nf->isReadOnly()); |
|
| 25 | |||
| 26 | //Check for existence of grid field |
||
| 27 | 1 | $nf = $this->checkFieldExists($tab, 'SearchableField'); |
|
| 28 | 1 | } |
|
| 29 | |||
| 39 |
Since your code implements the magic setter
_set, this function will be called for any write access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.