public function testItStartsWithNotStrictThrowsException()
 {
     $array = new \SplFixedArray(2);
     $array[0] = 'some-value';
     $array[1] = 1337;
     $this->setExpectedException(Exception::class);
     Assert::startsWith($array, '1338');
 }
Example #2
0
 public function testItShouldCheckHasInterfaceFromThrowException()
 {
     $this->setExpectedException(Exception::class);
     Assert::hasInterface(new \stdClass(), DummyInterface::class);
 }
Example #3
0
 public function testItIsTitleCaseThrowsException()
 {
     $this->setExpectedException(Exception::class);
     Assert::isTitleCase('The Star wars');
 }
 public function testItShouldCheckNotEqualsThrowsException()
 {
     $this->setExpectedException(Exception::class);
     Assert::notEquals(10, 10);
 }
 public function testItShouldCheckIfItIsMultipleThrowsException()
 {
     $this->setExpectedException(Exception::class);
     Assert::isMultiple(13, 7);
 }
 public function testItShouldCheckIfNotOverwritingExistingFileUploadManyThrowsException()
 {
     $this->setExpectedException(Exception::class);
     Assert::isFileUploadedNotOverwritingExistingFile('image_set', \realpath(\dirname(__FILE__)) . '/resources');
 }
 /**
  * @param $value
  *
  * @throws \Exception
  */
 protected function guard($value)
 {
     Assert::isInstanceOf($value, self::$instance);
 }
 /**
  * @param array $values
  *
  * @return array
  */
 protected function fetchIds(array $values) : array
 {
     $ids = [];
     foreach ($values as $value) {
         Assert::isInstanceOf($value, Identity::class);
         if (null !== $value->id()) {
             $ids[] = $value->id();
         }
     }
     return $ids;
 }
 public function testItIsDayLightSavingTimeThrowsException()
 {
     $this->setExpectedException(Exception::class);
     $value = new DateTime('22-03-2016', new DateTimeZone('Europe/Madrid'));
     Assert::isDayLightSavingTime($value, $value->getTimezone());
 }
Example #10
0
 public function testItWillThrowRuntimeExceptionWhenNonExistentMethodIsCalled()
 {
     $this->setExpectedException(RuntimeException::class);
     Assert::hola();
 }