public function testRetrievedValue()
 {
     $data = Introspekt::get(new WebService())->getAnnotation("@ServiceData");
     $this->assertTrue(4 === count($data));
     $this->assertEquals("8001", $data["port"]);
     $this->assertEquals("hello123", $data["passw"]);
 }
 public function testRetrievedValue()
 {
     $annotations = Introspekt::get(new Hacker());
     $langs = $annotations->getAnnotation("@Languages");
     $this->assertTrue(3 === count($langs));
     $this->assertEquals("php", $langs[0]);
     $this->assertEquals("javascript", $langs[2]);
 }
 public function testStackingObjects()
 {
     $anno = Introspekt::get(new StackedObject());
     $queryParams = $anno->getAnnotation("@QueryParam");
     $this->assertEquals(3, count($queryParams));
     $this->assertEquals("fabs", $queryParams[0]["name"]);
     $this->assertEquals("text", $queryParams[1]["surname"]);
     $this->assertEquals("nowhere", $queryParams[2]["nationality"]);
 }
 public function testAnnotationsParcelsOfTheSameClassAreASingleInstance()
 {
     $hackerAnnotations1 = Introspekt::get(new Hacker());
     $hackerAnnotations2 = Introspekt::get(new Hacker());
     $hackerAnnotations3 = Introspekt::get(new Hacker());
     $this->assertEquals(1, count(Introspekt::getAnnotationsParcels()));
     $wsAnnotations = Introspekt::get(new WebService());
     $this->assertEquals(2, count(Introspekt::getAnnotationsParcels()));
     // note the double backslash to escape meta characters like \n and \t
     $this->assertEquals(1, count(Introspekt::getAnnotationsParcelByClassName("artifacts\\Hacker")));
     $this->assertEquals(1, count(Introspekt::getAnnotationsParcelByClassName("artifacts\\WebService")));
 }
 /**
  * @expectedException introspekt\exception\NoAnnotationFoundException
  */
 public function testMissingValue()
 {
     $annotations = Introspekt::get(new Hacker());
     $this->assertEquals($annotations->getAnnotation("@Nooooot", "hackit"));
 }
 public function testRetrievedValue()
 {
     $annotations = Introspekt::get(new Person());
     $this->assertEquals("Laurent", $annotations->getAnnotation("@Name"));
 }
 public function testDangerousAnnotationValues()
 {
     $annotations = Introspekt::get(new Danger());
     $this->assertEquals("*****@*****.**", $annotations->getAnnotation("@Email"));
 }
 /**
  * @expectedException introspekt\exception\NoAnnotationFoundException
  */
 public function testRetrieval()
 {
     Introspekt::get(new Person())->getAnnotation("@Not");
 }
 public function setUp()
 {
     $this->annotations = Introspekt::get(new DBBean());
 }
 public function testRetrievalUsingClassName()
 {
     // note the double escape to prevent \n in \nourdine to be interpreted as a new line character
     Introspekt::get("artifacts\\Hacker");
     $this->assertTrue(Introspekt::get(new Hacker()) instanceof AnnotationsParcel);
 }
 public function testRetrievedValue()
 {
     $annotations = Introspekt::get(new Geometry());
     $this->assertEquals(3.14159, $annotations->getAnnotation("@PI"));
     $this->assertEquals(5, $annotations->getAnnotation("@ShapeSides"));
 }