Exemple #1
0
 /**
  * @covers Alchemy\Phrasea\Border\Visa::isValid
  */
 public function testIsValid()
 {
     $visa = new Visa();
     $this->assertTrue($visa->isValid());
     $response = new Response(true, new Filename(self::$DI['app']));
     $visa->addResponse($response);
     $this->assertTrue($visa->isValid());
     $response2 = new Response(false, new Filename(self::$DI['app']));
     $visa->addResponse($response2);
     $this->assertFalse($visa->isValid());
 }
Exemple #2
0
 /**
  * Check a File package object against the Checkers, and returns a Visa
  *
  * @param  File $file A File package object
  * @return Visa The Visa
  */
 public function getVisa(File $file)
 {
     $visa = new Visa();
     if (!$this->isEnabled()) {
         return $visa;
     }
     foreach ($this->checkers as $checker) {
         $visa->addResponse($checker->check($this->app['orm.em'], $file));
     }
     return $visa;
 }
Exemple #3
0
 /**
  * Check a File package object against the Checkers, and returns a Visa
  *
  * @param  File $file A File package object
  * @return Visa The Visa
  */
 public function getVisa(File $file)
 {
     $visa = new Visa();
     foreach ($this->checkers as $checker) {
         $visa->addResponse($checker->check($this->app['EM'], $file));
     }
     return $visa;
 }