-
-
Notifications
You must be signed in to change notification settings - Fork 585
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
673296f
commit 3136c33
Showing
4 changed files
with
92 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,7 +69,6 @@ | |
"tw-p-[10px]", | ||
"tw-p-m", | ||
"tw-p-none", | ||
"tw-px-2", | ||
"tw-px-2.5", | ||
"tw-px-4", | ||
"tw-px-[15px]", | ||
|
84 changes: 84 additions & 0 deletions
84
tests/Unit/app/Domain/Calendar/Services/CalendarServiceTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
|
||
namespace Unit\app\Domain\Menu\Repositories; | ||
|
||
use Codeception\Test\Unit; | ||
use Leantime\Config\Config; | ||
use Leantime\Core\Configuration\Environment; | ||
use Leantime\Core\Events\EventDispatcher; | ||
use Leantime\Core\Language; | ||
use Leantime\Domain\Calendar\Repositories\Calendar as CalendarRepo; | ||
use Leantime\Domain\Calendar\Services\Calendar; | ||
use Leantime\Domain\Menu\Repositories\Menu; | ||
use Leantime\Domain\Setting\Repositories\Setting; | ||
use Leantime\Domain\Tickets\Services\Tickets; | ||
|
||
class CalendarServiceTest extends Unit | ||
{ | ||
|
||
use \Codeception\Test\Feature\Stub; | ||
|
||
protected $calendarRepo; | ||
|
||
protected $language; | ||
|
||
protected $settingsRepo; | ||
|
||
protected $config; | ||
|
||
protected $calendar; | ||
|
||
/** | ||
* The test object | ||
* | ||
* @var Menu | ||
*/ | ||
protected $menu; | ||
|
||
protected function _before() | ||
{ | ||
|
||
$this->calendarRepo = $this->make(CalendarRepo::class); | ||
$this->language = $this->make(Language::class); | ||
$this->settingsRepo = $this->make(Setting::class, [ | ||
"getSetting" => "secret" | ||
]); | ||
$this->config = $this->make(Environment::class, [ | ||
"sessionPassword" => "123abc" | ||
]); | ||
|
||
//Load class to be tested | ||
$this->calendar = new \Leantime\Domain\Calendar\Services\Calendar( | ||
calendarRepo: $this->calendarRepo, | ||
language: $this->language, | ||
settingsRepo: $this->settingsRepo, | ||
config: $this->config | ||
|
||
); | ||
|
||
} | ||
|
||
protected function _after() | ||
{ | ||
$this->calendar = null; | ||
} | ||
|
||
//Write tests below | ||
|
||
/** | ||
* Test GetMenuTypes method | ||
*/ | ||
public function testGetICalUrl() { | ||
|
||
|
||
|
||
//Sha is generated from id -1 and sessionpassword 123abc | ||
$sha = "ba62fbd0d08f6607d6b3213dcccc1b50f4d82f19"; | ||
$url = $this->calendar->getICalUrl(1); | ||
|
||
$this->assertEquals(BASE_URL . "/calendar/ical/secret_" . $sha, $url, 'hash is not correct'); | ||
|
||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters