-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathPostComment.php
More file actions
61 lines (48 loc) · 1.54 KB
/
PostComment.php
File metadata and controls
61 lines (48 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* Created by JetBrains PhpStorm.
* User: alex
* Date: 27/08/2013
* Time: 08:29
* To change this template use File | Settings | File Templates.
*/
namespace DrupalPatchUtils\Command;
use DrupalPatchUtils\DoBrowser;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class PostComment extends CommandBase {
protected function configure()
{
$this
->setName('postComment')
->setAliases(array('pc'))
->setDescription('Posts comment to d.o.')
->addArgument(
'url',
InputArgument::REQUIRED,
'What is the url of the issue to retrieve?'
);
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$issue = $this->getIssue($input->getArgument('url'));
if ($issue) {
$browser = new DoBrowser();
$this->ensureUserIsLoggedIn($browser, $output);
$comment_form = $browser->getCommentForm($issue->getUri());
$comment_form->setStatusNeedsWork();
$comment_form->setCommentText('Automated Alex!');
$comment_form->ensureTag($comment_form::TAG_NEEDS_REROLL);
$browser->submitForm($comment_form->getForm());
//$comment = $comment_form->get('comment');
//$comment->setValue('Testing...');
//$comment_form->set($comment);
//$tags = $comment_form->get('taxonomy[tags]');
//var_dump($tags);
//$browser->submitForm($comment_form);
//var_dump($comment);
//var_dump($comment_form);
}
}
}