setWith() public method

public setWith ( $value )
コード例 #1
0
ファイル: equals.php プロジェクト: atoum/phpunit-extension
 protected function matches($actual)
 {
     if ($this->delta == null && $this->analyzer->isFloat($actual) === false && $this->analyzer->isFloat($this->expected) === false) {
         $asserter = new asserters\variable(null, $this->analyzer);
         if ($this->analyzer->isString($actual) && $this->ignoreCase) {
             $actual = strtolower($actual);
         }
         if ($this->analyzer->isArray($actual) && $this->canonicalize) {
             $actual = sort($actual);
         }
         $asserter->setWith($actual);
         if ($actual === 0 && $this->expected == '' || $actual == '' && $this->expected === 0) {
             $asserter->isIdenticalTo($this->expected);
         } else {
             $expected = $this->expected;
             if ($this->analyzer->isString($expected) && $this->ignoreCase) {
                 $expected = strtolower($expected);
             }
             if ($this->analyzer->isArray($expected) && $this->canonicalize) {
                 $expected = sort($expected);
             }
             $asserter->isEqualTo($expected);
         }
     } else {
         $asserter = new asserters\phpFloat(null, $this->analyzer);
         $asserter->setWith((double) $actual)->isNearlyEqualTo((double) $this->expected, $this->delta);
     }
 }