Esempio n. 1
0
 /**
  * @inheritdoc
  */
 public function setUp()
 {
     parent::setUp();
     $this->workflow = $this->getMockBuilder(Workflow::class)->disableOriginalConstructor()->getMock();
     $this->workflows = $this->getMockBuilder(Workflows::class)->disableOriginalConstructor()->getMock();
     $this->site = $this->getMockBuilder(Site::class)->disableOriginalConstructor()->getMock();
     $this->site->method('getWorkflows')->willReturn($this->workflows);
     $this->model = new NewRelic(null, ['site' => $this->site]);
     $this->model->setRequest($this->request);
     $this->model->setConfig($this->config);
 }
Esempio n. 2
0
 /**
  * @inheritdoc
  */
 public function setUp()
 {
     parent::setUp();
     $this->workflow = $this->getMockBuilder(Workflow::class)->disableOriginalConstructor()->getMock();
     $this->workflows = $this->getMockBuilder(Workflows::class)->disableOriginalConstructor()->getMock();
     $this->site = $this->getMockBuilder(Site::class)->disableOriginalConstructor()->getMock();
     $this->site->method('getWorkflows')->willReturn($this->workflows);
     $this->collection = $this->getMockBuilder(Branches::class)->disableOriginalConstructor()->getMock();
     $this->collection->site = $this->site;
     $this->model = new Branch((object) ['id' => 'branch_id', 'sha' => 'sha'], ['collection' => $this->collection]);
     $this->model->setRequest($this->request);
 }
 /**
  * @inheritdoc
  */
 protected function setUp()
 {
     if (!$this->config) {
         $this->config = new Config();
     }
     if (!$this->container) {
         $this->container = new Container();
     }
     // These are not used by every test but are useful for SiteAwareInterface commands. Which is a lot of them.
     // Use `$command->setSites($this->site());` after you create your command to test.
     $this->site = $this->getMockBuilder(Site::class)->disableOriginalConstructor()->getMock();
     $this->environment = $this->getMockBuilder(Environment::class)->disableOriginalConstructor()->getMock();
     $this->environments = $this->getMockBuilder(Environments::class)->disableOriginalConstructor()->getMock();
     $this->environments->method('get')->willReturn($this->environment);
     $this->site->method('getEnvironments')->willReturn($this->environments);
     $this->sites = $this->getMockBuilder(Sites::class)->disableOriginalConstructor()->getMock();
     $this->sites->method('get')->willReturn($this->site);
     // A lot of commands output to a logger.
     // To use this call `$command->setLogger($this->logger);` after you create your command to test.
     $this->logger = $this->getMockBuilder(NullLogger::class)->setMethods(array('log'))->getMock();
 }