Source of file IssueTrackerSystemTest.php
Size: 1,434 Bytes - Last Modified: 2021-12-23T10:08:54+00:00
/var/www/docs.ssmods.com/process/src/tests/unit/IssueTrackerSystemTest.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 | <?php use SilverStripe\Dev\SapphireTest; use SilverStripe\Core\Config\Config; use SilverStripe\Core\Injector\Injector; use NZTA\SDLT\IssueTracker\IssueTrackerSystem; use NZTA\SDLT\Test\MockIssueTracker; /** * Tests aspects of {@link SecurityComponent} logic. */ class IssueTrackerSystemTest extends SapphireTest { public function test_factory_no_provider() { Config::nest(); Config::modify()->set(IssueTrackerSystem::class, 'provider', null); $this->expectException('Exception'); $this->expectExceptionMessage('Please configure the SDLT with a valid ticket system provider.'); Injector::inst()->create('IssueTrackerService'); Config::unnest(); } public function test_factory_bad_provider() { Config::nest(); Config::modify()->set(IssueTrackerSystem::class, 'provider', 'foo\bar\baz'); $this->expectException('Exception'); $this->expectExceptionMessage('No issue tracker provider called "foo\bar\baz" was found.'); Injector::inst()->create('IssueTrackerService'); Config::unnest(); } public function test_factory_good_instance() { Config::nest(); Config::modify()->set(IssueTrackerSystem::class, 'provider', MockIssueTracker::class); $this->assertInstanceOf(IssueTrackerSystem::class, Injector::inst()->create('IssueTrackerService')); Config::unnest(); } } |