/** * Will test the check() method * * @return void */ public function testCheck() { // Get the lint $lint = new PhpLint(); // Make one successful test where we have to remove some tags $this->assertTrue($lint->check('<?php $test = true;')); // Make one successful test where we do not have to do anything $this->assertTrue($lint->check('$test = true;')); // Make some tests which fail $this->assertFalse($lint->check('$test ====== true;')); $this->assertFalse($lint->check('$test = true')); }
/** * Will test if the assertion will result in a valid PHP statement * * @return boolean */ public function isValid() { // We need our lint class $lint = new PhpLint(); // Wrap the code as a condition for an if clause return $lint->check('if(' . $this->getString() . '){}'); }