added punch-in punch-out / time-clock mode (#812)

This commit is contained in:
Kevin Papst
2019-05-27 01:36:43 +02:00
committed by GitHub
parent ebff4a765a
commit d9dca96a32
20 changed files with 231 additions and 113 deletions

View File

@@ -120,9 +120,9 @@ class TimesheetTeamControllerTest extends ControllerBaseTest
$this->request($client, '/team/timesheet/create');
$this->assertTrue($client->getResponse()->isSuccessful());
$form = $client->getCrawler()->filter('form[name=timesheet_edit_form]')->form();
$form = $client->getCrawler()->filter('form[name=timesheet_admin_edit_form]')->form();
$client->submit($form, [
'timesheet_edit_form' => [
'timesheet_admin_edit_form' => [
'description' => 'Testing is fun!',
'project' => 1,
'activity' => 1,
@@ -170,9 +170,9 @@ class TimesheetTeamControllerTest extends ControllerBaseTest
'Could not find link to documentation'
);
$form = $client->getCrawler()->filter('form[name=timesheet_edit_form]')->form();
$form = $client->getCrawler()->filter('form[name=timesheet_admin_edit_form]')->form();
$client->submit($form, [
'timesheet_edit_form' => [
'timesheet_admin_edit_form' => [
'description' => 'foo-bar',
'tags' => 'foo,bar, testing, hello world,,',
'user' => $teamlead->getId()

View File

@@ -25,8 +25,9 @@ class TimesheetConfigExtensionTest extends TestCase
$config = new TimesheetConfiguration($loader, ['mode' => 'duration_only']);
$sut = new TimesheetConfigExtension($config);
$filters = $sut->getFunctions();
$this->assertCount(1, $filters);
$this->assertCount(2, $filters);
$this->assertEquals('is_duration_only', $filters[0]->getName());
$this->assertEquals('is_punch_mode', $filters[1]->getName());
}
public function testIsDurationOnly()
@@ -35,6 +36,7 @@ class TimesheetConfigExtensionTest extends TestCase
$config = new TimesheetConfiguration($loader, ['mode' => 'duration_only']);
$sut = new TimesheetConfigExtension($config);
$this->assertTrue($sut->isDurationOnly());
$this->assertFalse($sut->isPunchInOut());
}
public function testIsNotDurationOnly()
@@ -43,5 +45,15 @@ class TimesheetConfigExtensionTest extends TestCase
$config = new TimesheetConfiguration($loader, ['mode' => 'default']);
$sut = new TimesheetConfigExtension($config);
$this->assertFalse($sut->isDurationOnly());
$this->assertFalse($sut->isPunchInOut());
}
public function testIsPunchInOut()
{
$loader = $this->getMockBuilder(ConfigLoaderInterface::class)->getMock();
$config = new TimesheetConfiguration($loader, ['mode' => 'punch']);
$sut = new TimesheetConfigExtension($config);
$this->assertFalse($sut->isDurationOnly());
$this->assertTrue($sut->isPunchInOut());
}
}