Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / drydock / operation / DrydockTestRepositoryOperation.php
blob0b0efbad0a1f0b777987759cfa4b45e0c38db08c
1 <?php
3 final class DrydockTestRepositoryOperation
4 extends DrydockRepositoryOperationType {
6 const OPCONST = 'test';
8 public function getOperationDescription(
9 DrydockRepositoryOperation $operation,
10 PhabricatorUser $viewer) {
11 return pht('Test Configuration');
14 public function getOperationCurrentStatus(
15 DrydockRepositoryOperation $operation,
16 PhabricatorUser $viewer) {
18 $repository = $operation->getRepository();
19 switch ($operation->getOperationState()) {
20 case DrydockRepositoryOperation::STATE_WAIT:
21 return pht(
22 'Waiting to test configuration for %s...',
23 $repository->getMonogram());
24 case DrydockRepositoryOperation::STATE_WORK:
25 return pht(
26 'Testing configuration for %s. This may take a moment if Drydock '.
27 'has to clone the repository for the first time.',
28 $repository->getMonogram());
29 case DrydockRepositoryOperation::STATE_DONE:
30 return pht(
31 'Success! Automation is configured properly and Drydock can '.
32 'operate on %s.',
33 $repository->getMonogram());
37 public function applyOperation(
38 DrydockRepositoryOperation $operation,
39 DrydockInterface $interface) {
40 $repository = $operation->getRepository();
42 if ($repository->isGit()) {
43 $interface->execx('git status');
44 } else if ($repository->isHg()) {
45 $interface->execx('hg status');
46 } else if ($repository->isSVN()) {
47 $interface->execx('svn status');
48 } else {
49 throw new PhutilMethodNotImplementedException();