2015-04-07 16:23:48 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace DavidBadura\Taskwarrior\Test;
|
|
|
|
|
|
|
|
use DavidBadura\Taskwarrior\Taskwarrior;
|
|
|
|
use Symfony\Component\Filesystem\Filesystem;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author David Badura <badura@simplethings.de>
|
|
|
|
*/
|
|
|
|
class TaskwarriorTest extends \PHPUnit_Framework_TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var Taskwarrior
|
|
|
|
*/
|
|
|
|
protected $taskwarrior;
|
|
|
|
|
|
|
|
public function setUp()
|
|
|
|
{
|
|
|
|
$this->tearDown();
|
|
|
|
$this->taskwarrior = new Taskwarrior(__DIR__ . '/.taskrc', __DIR__ . '/.task');
|
|
|
|
$this->taskwarrior->version(); // to initialise
|
|
|
|
}
|
|
|
|
|
|
|
|
public function tearDown()
|
|
|
|
{
|
|
|
|
$fs = new Filesystem();
|
|
|
|
$fs->remove(__DIR__ . '/.taskrc');
|
|
|
|
$fs->remove(__DIR__ . '/.task');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testConfig()
|
|
|
|
{
|
|
|
|
$config = $this->taskwarrior->config();
|
|
|
|
|
2015-04-23 14:09:52 -05:00
|
|
|
$this->assertInstanceOf('DavidBadura\Taskwarrior\Config\Config', $config);
|
2015-04-22 07:41:51 -05:00
|
|
|
$this->assertTrue($config->has('urgency.age.max'));
|
|
|
|
$this->assertEquals('365', $config->get('urgency.age.max'));
|
2015-04-07 16:23:48 -05:00
|
|
|
}
|
2015-07-07 16:27:06 -05:00
|
|
|
|
|
|
|
public function testTaskrcNotFound()
|
|
|
|
{
|
|
|
|
$this->setExpectedException('DavidBadura\Taskwarrior\Exception\TaskwarriorException');
|
|
|
|
|
|
|
|
new Taskwarrior('/not/found/.taskrc', __DIR__ . '/.task');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testTaskDataNotFound()
|
|
|
|
{
|
|
|
|
$this->setExpectedException('DavidBadura\Taskwarrior\Exception\TaskwarriorException');
|
|
|
|
|
|
|
|
new Taskwarrior(__DIR__ . '/.taskrc', '/not/found/.task');
|
|
|
|
}
|
2015-04-07 16:23:48 -05:00
|
|
|
}
|