public function setUp() { parent::setUp(); $resource = new ApiResource('posts', ['entity' => Post::class, 'filter' => PostFilter::class, 'pagination' => ['enabled' => true, 'limit' => 10], 'form_type' => DynamicFormType::class, 'identifier' => 'id']); $resource->setConfigName('posts'); $this->router = $this->client->getContainer()->get('router'); $resource->addAction(new Index($this->router)); $resource->addAction(new Create($this->router)); $this->manager = new ApiManager(); $this->manager->addResource($resource); }
public function setUp() { $router = $this->getMockBuilder(Router::class)->disableOriginalConstructor()->getMock(); $this->config = new ApiResource('posts', ['entity' => Post::class, 'filter' => null, 'pagination' => ['enabled' => false, 'limit' => 10], 'form_type' => DynamicFormType::class, 'identifier' => 'id']); $this->config->setConfigName('posts'); $this->config->addAction(new Index($router)); $this->config->addAction(new Create($router)); $this->config->addAction(new Show($router)); $this->config->addAction(new Update($router)); $this->config->addAction(new Delete($router)); $manager = new ApiManager(); $manager->addResource($this->config); }