/** * Command logic * * @param InputInterface $input * @param OutputInterface $output */ protected function execute(InputInterface $input, OutputInterface $output) { $org_repo = new Organization(App::getInstance()->resolve(Request::class)); $org_collection = $org_repo->all(); foreach ($org_collection as $org) { $this->updateOtrs($org, $output); } }
public function testShouldRetrieveOrganizationsCollection() { $expected = $this->buildResult(); $requestMock = $this->getMockBuilder('Sync\\Pipedrive\\Request')->setMethods(['get'])->getMock(); $requestMock->expects($this->once())->method('get')->will($this->returnValue($expected)); $repository = new OrganizationRepository($requestMock); $result = $repository->all(); $this->assertCount(3, $result); $this->assertEquals($expected[0]['name'], $result[0]->getName()); $this->assertEquals($expected[1]['name'], $result[1]->getName()); $this->assertEquals($expected[2]['name'], $result[2]->getName()); }