function expectArgumentError($message)
 {
     try {
         $extension = new \ReflectionExtension('functional');
         $extensionFunctions = array_keys($extension->getFunctions());
         $isDefinedInExtension = F\every($this->functions, function ($function) use($extensionFunctions) {
             return in_array($function, $extensionFunctions, true);
         });
         if ($isDefinedInExtension) {
             $this->setExpectedException('PHPUnit_Framework_Error_Warning', $message);
         } else {
             $this->setExpectedException('Functional\\Exceptions\\InvalidArgumentException', $message);
         }
     } catch (\ReflectionException $e) {
         $this->setExpectedException('Functional\\Exceptions\\InvalidArgumentException', $message);
     }
 }
Exemplo n.º 2
0
 public function testExceptionIsThrownInCollection()
 {
     $this->setExpectedException('DomainException', 'Callback exception');
     every($this->goodIterator, [$this, 'exception']);
 }
Exemplo n.º 3
0
 public function typeof(Type $type)
 {
     return array_every($this->types, function (Type $element, $key, array $collection) use($type) {
         return Type::intersect($type, $element);
     });
 }