diff options
Diffstat (limited to 'tests/units/EventBuilder/ProjectFileEventBuilderTest.php')
-rw-r--r-- | tests/units/EventBuilder/ProjectFileEventBuilderTest.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/units/EventBuilder/ProjectFileEventBuilderTest.php b/tests/units/EventBuilder/ProjectFileEventBuilderTest.php new file mode 100644 index 00000000..bfe22719 --- /dev/null +++ b/tests/units/EventBuilder/ProjectFileEventBuilderTest.php @@ -0,0 +1,33 @@ +<?php + +use Kanboard\EventBuilder\ProjectFileEventBuilder; +use Kanboard\Model\ProjectFileModel; +use Kanboard\Model\ProjectModel; + +require_once __DIR__.'/../Base.php'; + +class ProjectFileEventBuilderTest extends Base +{ + public function testWithMissingFile() + { + $projectFileEventBuilder = new ProjectFileEventBuilder($this->container); + $projectFileEventBuilder->withFileId(42); + $this->assertNull($projectFileEventBuilder->build()); + } + + public function testBuild() + { + $projectModel = new ProjectModel($this->container); + $projectFileModel = new ProjectFileModel($this->container); + $projectFileEventBuilder = new ProjectFileEventBuilder($this->container); + + $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); + $this->assertEquals(1, $projectFileModel->create(1, 'Test', '/tmp/test', 123)); + + $event = $projectFileEventBuilder->withFileId(1)->build(); + + $this->assertInstanceOf('Kanboard\Event\ProjectFileEvent', $event); + $this->assertNotEmpty($event['file']); + $this->assertNotEmpty($event['project']); + } +} |