Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reroll of 108 #118

Merged
merged 6 commits into from
Sep 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Commands/Send.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ protected function configure() {
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output) {
// Check for any open time logs first.
if ($open = $this->repository->getActive()) {
$details = $this->connector->ticketDetails($open->getTicketId(), $open->getConnectorId());
$output->writeLn(sprintf('<error>Please stop open time logs first: %s [<info>%d</info>]</error>',
$details->getTitle(),
$open->getTicketId()
));
return;
}

// Find any untagged items needing review, use an arbitrarily early date.
$review = $this->reviewer->getSummary(static::ALL, TRUE);
if (count($review) > 2) {
Expand Down
38 changes: 38 additions & 0 deletions tests/Commands/SendTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* @file
* Contains \Larowlan\Tl\Tests\Commands\SendTest.php
*/

namespace Larowlan\Tl\Tests\Commands;

use Larowlan\Tl\Tests\TlTestBase;
use Larowlan\Tl\Ticket;

/**
* @coversDefaultClass \Larowlan\Tl\Commands\Send
* @group Commands
*/
class SendTest extends TlTestBase {

/**
* @covers ::execute
*/
public function testSend() {
$this->setupConnector();
// Start time log on a ticket.
$this->executeCommand('start', [
'issue_number' => 1234,
'comment' => 'Foo bar',
]);
$this->getRepository()->tag(9, 1234);
$this->assertTicketIsOpen(1234, 'Foo bar');
$this->getMockConnector()->expects($this->any())
->method('ticketDetails')
->with(1234)
->willReturn(new Ticket('Running tests', 1234));
$output = $this->executeCommand('send');
$this->assertEquals('Please stop open time logs first: Running tests [1234]', trim($output->getDisplay()));
}

}