This component provides methods for reading annotations assigned to a class, method or property.
Inheritance: use trait Webiny\Component\StdLib\ComponentTrait
Beispiel #1
0
 public function setUp()
 {
     Annotations::setConfig(__DIR__ . '/../Mocks/MockAnnotationsConfig.yaml');
     Rest::setConfig(__DIR__ . '/../Mocks/MockRestConfig.yaml');
     // we need to create the cache files so we can test the router
     $parser = new Parser();
     $parserApi = $parser->parseApi('Webiny\\Component\\Rest\\Tests\\Mocks\\MockApiClassRouter', true);
     self::$cache = new Cache(new ArrayDriver());
     $instance = new Compiler('ExampleApi', true, self::$cache);
     $instance->writeCacheFiles($parserApi);
 }
Beispiel #2
0
 public function testGetMethodAnnotations()
 {
     $annotations = Annotations::getMethodAnnotations('\\Webiny\\Component\\Annotations\\Tests\\TestClass', 'someMethod');
     $this->assertNotNull($annotations->post);
     $this->assertNotNull($annotations->get);
     $this->assertNull($annotations->delete);
     $this->assertSame("10", $annotations->cache->ttl);
     $this->assertSame("true", $annotations->cache->store);
     $this->assertSame("cacheKey", $annotations->cache->key);
     $this->assertContains("json", $annotations->accept);
     $this->assertNotContains("csv", $annotations->accept);
 }
Beispiel #3
0
 public function setUp()
 {
     Annotations::setConfig(__DIR__ . '/../Mocks/MockAnnotationsConfig.yaml');
     Cache::setConfig(__DIR__ . '/../Mocks/MockCacheConfig.yaml');
     Rest::setConfig(__DIR__ . '/../Mocks/MockRestConfig.yaml');
 }
Beispiel #4
0
 /**
  * Get the name of bridge library which will be used as the driver.
  *
  * @return string
  */
 public static function getLibrary()
 {
     return \Webiny\Component\Annotations\Annotations::getConfig()->get('Bridge', self::$library);
 }
 public function setUp()
 {
     Annotations::setConfig(__DIR__ . '/ExampleConfig.yaml');
 }