コード例 #1
0
ファイル: TextTest.php プロジェクト: alphadevx/alpha
 /**
  * Testing the setSize method to see if validation fails.
  *
  * @since 1.0
  */
 public function testSetSizeInvalid()
 {
     $this->txt = new Text();
     $this->txt->setSize(4);
     try {
         $this->txt->setValue('Too many characters!');
         $this->fail('testing the setSize method to see if validation fails');
     } catch (IllegalArguementException $e) {
         $this->assertEquals('Not a valid text value!', $e->getMessage(), 'testing the setSize method to see if validation fails');
     }
 }
コード例 #2
0
ファイル: Article.php プロジェクト: alphadevx/alpha
 /**
  * Loads the content of the ArticleObject from the specified file path.
  *
  * @param $filePath
  *
  * @since 1.0
  *
  * @throws Alpha\Exception\FileNotFoundException
  */
 public function loadContentFromFile($filePath)
 {
     try {
         $this->content->setValue(file_get_contents($filePath));
         $this->filePath = $filePath;
     } catch (\Exception $e) {
         throw new FileNotFoundException($e->getMessage());
     }
 }