Skip to content
This repository was archived by the owner on May 1, 2019. It is now read-only.

Commit 7359ab6

Browse files
committed
CS fixes
1 parent d48d962 commit 7359ab6

File tree

2 files changed

+38
-39
lines changed

2 files changed

+38
-39
lines changed

module/ZfModule/src/ZfModule/Controller/IndexController.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
use Application\Service\RepositoryRetriever;
66
use EdpGithub\Collection\RepositoryCollection;
7+
use EdpGithub\Listener\Exception\RuntimeException as GithubException;
78
use Zend\Http;
89
use Zend\Mvc\Controller\AbstractActionController;
910
use Zend\View\Model\ViewModel;
1011
use ZfModule\Mapper;
1112
use ZfModule\Service;
12-
use EdpGithub\Listener\Exception\RuntimeException as GithubException;
1313

1414
class IndexController extends AbstractActionController
1515
{
@@ -94,15 +94,15 @@ public function indexAction()
9494
'errorMessage' => '',
9595
]);
9696
$viewModel->setTerminal(true);
97-
97+
9898
try {
9999
$repos = $this->repositoryRetriever->getAuthenticatedUserRepositories($params);
100100
$repositories = $this->fetchModules($repos);
101101
$viewModel->setVariable('repositories', $repositories);
102102
} catch (GithubException $ex) {
103103
$viewModel->setVariable('errorMessage', $ex->getMessage());
104104
}
105-
105+
106106
return $viewModel;
107107
}
108108

@@ -119,22 +119,21 @@ public function organizationAction()
119119
'direction' => 'desc',
120120
];
121121

122-
123122
$viewModel = new ViewModel([
124123
'repositories' => [],
125124
'errorMessage' => '',
126125
]);
127126
$viewModel->setTerminal(true);
128127
$viewModel->setTemplate('zf-module/index/index.phtml');
129-
128+
130129
try {
131130
$repos = $this->repositoryRetriever->getUserRepositories($owner, $params);
132131
$repositories = $this->fetchModules($repos);
133132
$viewModel->setVariable('repositories', $repositories);
134133
} catch (GithubException $ex) {
135134
$viewModel->setVariable('errorMessage', $ex->getMessage());
136135
}
137-
136+
138137
return $viewModel;
139138
}
140139

module/ZfModule/test/ZfModuleTest/Controller/IndexControllerTest.php

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,44 @@
22

33
namespace ZfModuleTest\Controller;
44

5-
use ZfModule\Controller\IndexController;
6-
use PHPUnit_Framework_TestCase;
7-
use ZfModule\Mapper\Module as ModuleMapper;
8-
use ZfModule\Service\Module as ModuleService;
95
use Application\Service\RepositoryRetriever;
10-
use ZfcUser\Controller\Plugin\ZfcUserAuthentication;
11-
use EdpGithub\Collection\RepositoryCollection;
126
use EdpGithub\Api;
7+
use EdpGithub\Collection\RepositoryCollection;
138
use EdpGithub\Listener\Exception\RuntimeException as EdpGithubRuntimeException;
9+
use PHPUnit_Framework_TestCase;
1410
use Zend\Mvc\Router\RouteMatch;
11+
use ZfcUser\Controller\Plugin\ZfcUserAuthentication;
12+
use ZfModule\Controller\IndexController;
13+
use ZfModule\Mapper\Module as ModuleMapper;
14+
use ZfModule\Service\Module as ModuleService;
1515

1616
class IndexControllerTest extends PHPUnit_Framework_TestCase
1717
{
1818
/**
1919
* @var IndexController
2020
*/
2121
protected $controller;
22-
22+
2323
/**
2424
* @var ModuleMapper
2525
*/
2626
protected $moduleMapper;
27-
27+
2828
/**
2929
* @var ModuleService
3030
*/
3131
protected $moduleService;
32-
32+
3333
/**
3434
* @var RepositoryRetriever
3535
*/
3636
protected $repositoryRetriever;
37-
37+
3838
/**
3939
* @var ZfcUserAuthentication
4040
*/
4141
protected $zfcUserAuthentication;
42-
42+
4343
public function setUp()
4444
{
4545
$this->moduleMapper = $this->getMockBuilder('ZfModule\Mapper\Module')
@@ -53,16 +53,16 @@ public function setUp()
5353
$this->repositoryRetriever = $this->getMockBuilder('Application\Service\RepositoryRetriever')
5454
->disableOriginalConstructor()
5555
->getMock();
56-
56+
5757
$this->controller = new IndexController(
5858
$this->moduleMapper,
5959
$this->moduleService,
6060
$this->repositoryRetriever
6161
);
62-
62+
6363
$this->zfcUserAuthentication = $this->getMockBuilder('ZfcUser\Controller\Plugin\ZfcUserAuthentication')
6464
->getMock();
65-
65+
6666
$this->controller->getPluginManager()->setService(
6767
'zfcUserAuthentication',
6868
$this->zfcUserAuthentication
@@ -74,93 +74,93 @@ public function testIndexActionReturnsRepositoryListOnSuccessfulSync()
7474
$this->zfcUserAuthentication->expects($this->once())
7575
->method('hasIdentity')
7676
->will($this->returnValue(true));
77-
77+
7878
$githubClient = $this->getClientMock(new Api\Repos(), [
7979
['name' => 'foo', 'fork' => false, 'permissions' => ['push' => true]]
8080
]);
8181
$githubResponse = new RepositoryCollection($githubClient->getHttpClient(), '');
82-
82+
8383
$this->repositoryRetriever->expects($this->once())
8484
->method('getAuthenticatedUserRepositories')
8585
->will($this->returnValue($githubResponse));
86-
86+
8787
$this->moduleService->expects($this->once())
8888
->method('isModule')
8989
->will($this->returnValue(true));
90-
90+
9191
$viewModel = $this->controller->indexAction();
9292
$this->assertInstanceOf('Zend\View\Model\ModelInterface', $viewModel);
9393
$this->assertEmpty($viewModel->errorMessage);
9494
$this->assertNotEmpty($viewModel->repositories);
9595
}
96-
96+
9797
public function testIndexActionReturnsErrorMessageWhenRepositoryRetrieverThrowsEdpGithubRuntimeException()
9898
{
9999
$this->zfcUserAuthentication->expects($this->once())
100100
->method('hasIdentity')
101101
->will($this->returnValue(true));
102102

103103
$exception = new EdpGithubRuntimeException('EdpGithub throws this exception');
104-
104+
105105
$this->repositoryRetriever->expects($this->once())
106106
->method('getAuthenticatedUserRepositories')
107107
->will($this->throwException($exception));
108-
108+
109109
$viewModel = $this->controller->indexAction();
110110
$this->assertInstanceOf('Zend\View\Model\ModelInterface', $viewModel);
111111
$this->assertEquals($exception->getMessage(), $viewModel->errorMessage);
112112
$this->assertEmpty($viewModel->repositories);
113113
}
114-
114+
115115
public function testOrganizationActionReturnsRepositoryListOnSuccessfulSync()
116116
{
117117
$this->zfcUserAuthentication->expects($this->once())
118118
->method('hasIdentity')
119119
->will($this->returnValue(true));
120-
120+
121121
$routeMatch = new RouteMatch(['owner' => 'zendframework']);
122122
$this->controller->getEvent()->setRouteMatch($routeMatch);
123-
123+
124124
$githubClient = $this->getClientMock(new Api\Repos(), [
125125
['name' => 'foo', 'fork' => false, 'permissions' => ['push' => true]]
126126
]);
127127
$githubResponse = new RepositoryCollection($githubClient->getHttpClient(), '');
128-
128+
129129
$this->repositoryRetriever->expects($this->once())
130130
->method('getUserRepositories')
131131
->will($this->returnValue($githubResponse));
132-
132+
133133
$this->moduleService->expects($this->once())
134134
->method('isModule')
135135
->will($this->returnValue(true));
136-
136+
137137
$viewModel = $this->controller->organizationAction();
138138
$this->assertInstanceOf('Zend\View\Model\ModelInterface', $viewModel);
139139
$this->assertEmpty($viewModel->errorMessage);
140140
$this->assertNotEmpty($viewModel->repositories);
141141
}
142-
142+
143143
public function testOrganizationActionReturnsErrorMessageWhenRepositoryRetrieverThrowsEdpGithubRuntimeException()
144144
{
145145
$this->zfcUserAuthentication->expects($this->once())
146146
->method('hasIdentity')
147147
->will($this->returnValue(true));
148-
148+
149149
$routeMatch = new RouteMatch(['owner' => 'zendframework']);
150150
$this->controller->getEvent()->setRouteMatch($routeMatch);
151-
151+
152152
$exception = new EdpGithubRuntimeException('EdpGithub throws this exception');
153-
153+
154154
$this->repositoryRetriever->expects($this->once())
155155
->method('getUserRepositories')
156156
->will($this->throwException($exception));
157-
157+
158158
$viewModel = $this->controller->organizationAction();
159159
$this->assertInstanceOf('Zend\View\Model\ModelInterface', $viewModel);
160160
$this->assertEquals($exception->getMessage(), $viewModel->errorMessage);
161161
$this->assertEmpty($viewModel->repositories);
162162
}
163-
163+
164164
/**
165165
* @param Api\AbstractApi $apiInstance
166166
* @param array $payload

0 commit comments

Comments
 (0)