◆ fetchFirstCreateTemplate()
      
        
          | ilCertificateTemplateRepositoryTest::fetchFirstCreateTemplate  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 497 of file ilCertificateTemplateRepositoryTest.php.
  499         $database = $this->createMock(ilDBInterface::class);
   501         $logger = $this->getMockBuilder(ilLogger::class)
   502             ->disableOriginalConstructor()
   505         $database->method(
'quote')
   506             ->with(10, 
'integer')
   509         $objectDataCache = $this->getMockBuilder(ilObjectDataCache::class)
   510             ->disableOriginalConstructor()
   513         $database->method(
'fetchAssoc')
   516         $database->method(
'fetchAssoc')->willReturn(
   521                 'certificate_content' => 
'<xml>Some Content</xml>',
   522                 'certificate_hash' => md5(
'<xml>Some Content</xml>'),
   523                 'template_values' => 
'[]',
   525                 'ilias_version' => 
'v5.4.0',
   526                 'created_timestamp' => 123_456_789,
   527                 'currently_active' => 
true,
   528                 'background_image_ident' => 
'/some/where/background.jpg'   534         $firstTemplate = $repository->fetchFirstCreatedTemplate(10);
   536         $this->assertSame(1, $firstTemplate->getId());
 
 
 
 
◆ testActivatePreviousCertificate()
      
        
          | ilCertificateTemplateRepositoryTest::testActivatePreviousCertificate  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 316 of file ilCertificateTemplateRepositoryTest.php.
  318         $logger = $this->getMockBuilder(ilLogger::class)
   319             ->disableOriginalConstructor()
   322         $database = $this->createMock(ilDBInterface::class);
   324         $quote_consecutive = [
   328         $database->method(
'quote')->willReturnCallback(
   329             function (
int $v, 
string $type) use (&$quote_consecutive) {
   330                 list($expected, $type) = array_shift($quote_consecutive);
   331                 $this->assertEquals(
'integer', $type);
   332                 $this->assertEquals($expected, $v);
   333                 return (
string) ($v);
   342                 'certificate_content' => 
'<xml>Some Content</xml>',
   343                 'certificate_hash' => md5(
'<xml>Some Content</xml>'),
   344                 'template_values' => 
'[]',
   346                 'ilias_version' => 
'v5.4.0',
   347                 'created_timestamp' => 123_456_789,
   348                 'currently_active' => 
true,
   349                 'background_image_path' => 
'/some/where/background.jpg',
   350                 'thumbnail_image_path' => 
'some/path/test.svg',
   351                 'background_image_ident' => 
'-',
   352                 'thumbnail_image_ident' => 
'-'   358                 'certificate_content' => 
'<xml>Some Other Content</xml>',
   359                 'certificate_hash' => md5(
'<xml>Some Content</xml>'),
   360                 'template_values' => 
'[]',
   362                 'ilias_version' => 
'v5.3.0',
   363                 'created_timestamp' => 123_456_789,
   364                 'currently_active' => 
false,
   365                 'background_image_path' => 
'/some/where/else/background.jpg',
   366                 'thumbnail_image_path' => 
'some/path/test.svg',
   367                 'background_image_ident' => 
'-',
   368                 'thumbnail_image_ident' => 
'-'   371         $database->method(
'fetchAssoc')->willReturnCallback(
   372             function () use (&$consecutive) {
   373                 return array_shift($consecutive);
   377         $query_consecutive = [
   378             "SELECT * FROM il_cert_template WHERE obj_id = 10 AND deleted = 0 ORDER BY version ASC",
   379             'UPDATE il_cert_template SET currently_active = 1 WHERE id = 30'   381         $database->method(
'query')->willReturnCallback(
   382             function (
string $v) use (&$query_consecutive) {
   383                 $expected = array_shift($query_consecutive);
   384                 $v = trim(str_replace(array(
"\n", 
"\r"), 
' ', $v))  ;
   385                 $this->assertEquals($expected, $v);
   386                 return $this->createMock(ilDBStatement::class);
   390         $objectDataCache = $this->getMockBuilder(ilObjectDataCache::class)
   391             ->disableOriginalConstructor()
   394         $objectDataCache->method(
'lookUpType')->willReturn(
'crs');
   398         $template = $repository->activatePreviousCertificate(10);
   400         $this->assertSame(30, $template->getId());
 
 
 
 
◆ testCertificateWillBeSavedToTheDatabase()
      
        
          | ilCertificateTemplateRepositoryTest::testCertificateWillBeSavedToTheDatabase  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 26 of file ilCertificateTemplateRepositoryTest.php.
   28         $database = $this->createMock(ilDBInterface::class);
    30         $logger = $this->getMockBuilder(ilLogger::class)
    31             ->disableOriginalConstructor()
    34         $objectDataCache = $this->getMockBuilder(ilObjectDataCache::class)
    35             ->disableOriginalConstructor()
    38         $objectDataCache->method(
'lookUpType')->willReturn(
'crs');
    40         $database->method(
'nextId')
    43         $database->method(
'insert')
    47                     'id' => [
'integer', 10],
    48                     'obj_id' => [
'integer', 100],
    49                     'obj_type' => [
'text', 
'crs'],
    50                     'certificate_content' => [
'clob', 
'<xml>Some Content</xml>'],
    51                     'certificate_hash' => [
'text', md5(
'<xml>Some Content</xml>')],
    52                     'template_values' => [
'clob', 
'[]'],
    53                     'version' => [
'integer', 1],
    54                     'ilias_version' => [
'text', 
'v5.4.0'],
    55                     'created_timestamp' => [
'integer', 123_456_789],
    56                     'currently_active' => [
'integer', 
true],
    57                     'deleted' => [
'integer', 0],
    58                     'background_image_path' => [
'text', 
'/some/where/background.jpg'],
    59                     'thumbnail_image_path' => [
'text', 
'/some/path/test.svg'],
    60                     'background_image_ident' => [
'text', 
'-'],
    61                     'thumbnail_image_ident' => [
'text', 
'-']
    65         $database->method(
'tableColumnExists')->willReturnMap(
    67                 [
'il_cert_user_cert', 
'background_image_path', 
true],
    68                 [
'il_cert_user_cert', 
'thumbnail_image_path', 
true],
    72         $logger->expects($this->atLeastOnce())
    78             '<xml>Some Content</xml>',
    79             md5(
'<xml>Some Content</xml>'),
    85             '/some/where/background.jpg',
    86             '/some/path/test.svg',
    93         $repository->save($template);
 
 
 
 
◆ testDeleteTemplateFromDatabase()
      
        
          | ilCertificateTemplateRepositoryTest::testDeleteTemplateFromDatabase  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 277 of file ilCertificateTemplateRepositoryTest.php.
  279         $database = $this->createMock(ilDBInterface::class);
   281         $logger = $this->getMockBuilder(ilLogger::class)
   282             ->disableOriginalConstructor()
   285         $quote_consecutive = [
   289         $database->method(
'quote')->willReturnCallback(
   290             function (
int $v, 
string $type) use (&$quote_consecutive) {
   291                 list($expected, $type) = array_shift($quote_consecutive);
   292                 $this->assertEquals(
'integer', $type);
   293                 $this->assertEquals($expected, $v);
   294                 return (
string) ($v);
   299         $database->method(
'query')
   301 DELETE FROM il_cert_template   305         $objectDataCache = $this->getMockBuilder(ilObjectDataCache::class)
   306             ->disableOriginalConstructor()
   309         $objectDataCache->method(
'lookUpType')->willReturn(
'crs');
   313         $repository->deleteTemplate(10, 200);
 
 
 
 
◆ testFetchAllObjectIdsByType()
      
        
          | ilCertificateTemplateRepositoryTest::testFetchAllObjectIdsByType  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 403 of file ilCertificateTemplateRepositoryTest.php.
  405         $logger = $this->getMockBuilder(ilLogger::class)
   406             ->disableOriginalConstructor()
   409         $objectDataCache = $this->getMockBuilder(ilObjectDataCache::class)
   410             ->disableOriginalConstructor()
   414         $database = $this->createMock(ilDBInterface::class);
   420                 'certificate_content' => 
'<xml>Some Content</xml>',
   421                 'certificate_hash' => md5(
'<xml>Some Content</xml>'),
   422                 'template_values' => 
'[]',
   424                 'ilias_version' => 
'v5.4.0',
   425                 'created_timestamp' => 123_456_789,
   426                 'currently_active' => 
true,
   427                 'background_image_path' => 
'/some/where/background.jpg',
   428                 'thumbnail_image_path' => 
'/some/where/thumbnail.svg',
   429                 'background_image_ident' => 
'-',
   430                 'thumbnail_image_ident' => 
'-'   436                 'certificate_content' => 
'<xml>Some Other Content</xml>',
   437                 'certificate_hash' => md5(
'<xml>Some Content</xml>'),
   438                 'template_values' => 
'[]',
   440                 'ilias_version' => 
'v5.3.0',
   441                 'created_timestamp' => 123_456_789,
   442                 'currently_active' => 
false,
   443                 'background_image_path' => 
'/some/where/else/background.jpg',
   444                 'thumbnail_image_path' => 
'/some/where/thumbnail.svg',
   445                 'background_image_ident' => 
'-',
   446                 'thumbnail_image_ident' => 
'-'   449         $database->method(
'fetchAssoc')->willReturnCallback(
   450             function () use (&$consecutive) {
   451                 return array_shift($consecutive);
   457         $templates = $repository->fetchActiveCertificateTemplatesForCoursesWithDisabledLearningProgress(
true);
   459         $this->assertSame(10, $templates[0]->getObjId());
   460         $this->assertSame(30, $templates[1]->getObjId());
 
 
 
 
◆ testFetchCertificateTemplatesByObjId()
      
        
          | ilCertificateTemplateRepositoryTest::testFetchCertificateTemplatesByObjId  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 96 of file ilCertificateTemplateRepositoryTest.php.
References ILIAS\Survey\Mode\getId().
   98         $logger = $this->getMockBuilder(ilLogger::class)
    99             ->disableOriginalConstructor()
   102         $database = $this->createMock(ilDBInterface::class);
   108                 'certificate_content' => 
'<xml>Some Content</xml>',
   109                 'certificate_hash' => md5(
'<xml>Some Content</xml>'),
   110                 'template_values' => 
'[]',
   112                 'ilias_version' => 
'v5.4.0',
   113                 'created_timestamp' => 123_456_789,
   114                 'currently_active' => 
true,
   115                 'background_image_path' => 
'/some/where/background.jpg',
   116                 'thumbnail_image_path' => 
'some/path/test.svg',
   117                 'background_image_ident' => 
'-',
   118                 'thumbnail_image_ident' => 
'-'   124                 'certificate_content' => 
'<xml>Some Other Content</xml>',
   125                 'certificate_hash' => md5(
'<xml>Some Content</xml>'),
   126                 'template_values' => 
'[]',
   128                 'ilias_version' => 
'v5.3.0',
   129                 'created_timestamp' => 123_456_789,
   130                 'currently_active' => 
false,
   131                 'background_image_path' => 
'/some/where/else/background.jpg',
   132                 'thumbnail_image_path' => 
'some/path/test.svg',
   133                 'background_image_ident' => 
'-',
   134                 'thumbnail_image_ident' => 
'-'   137         $database->method(
'fetchAssoc')->willReturnCallback(
   138             function () use (&$consecutive) {
   139                 return array_shift($consecutive);
   143         $objectDataCache = $this->getMockBuilder(ilObjectDataCache::class)
   144             ->disableOriginalConstructor()
   147         $objectDataCache->method(
'lookUpType')->willReturn(
'crs');
   151         $templates = $repository->fetchCertificateTemplatesByObjId(10);
   153         $this->assertSame(1, $templates[0]->
getId());
   154         $this->assertSame(30, $templates[1]->
getId());
 
 
 
 
◆ testFetchCurrentlyActiveCertificate()
      
        
          | ilCertificateTemplateRepositoryTest::testFetchCurrentlyActiveCertificate  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 157 of file ilCertificateTemplateRepositoryTest.php.
  159         $logger = $this->getMockBuilder(ilLogger::class)
   160             ->disableOriginalConstructor()
   163         $database = $this->createMock(ilDBInterface::class);
   169                 'certificate_content' => 
'<xml>Some Content</xml>',
   170                 'certificate_hash' => md5(
'<xml>Some Content</xml>'),
   171                 'template_values' => 
'[]',
   173                 'ilias_version' => 
'v5.4.0',
   174                 'created_timestamp' => 123_456_789,
   175                 'currently_active' => 
true,
   176                 'background_image_path' => 
'/some/where/background.jpg',
   177                 'thumbnail_image_path' => 
'some/path/test.svg',
   178                 'background_image_ident' => 
'-',
   179                 'thumbnail_image_ident' => 
'-'   185                 'certificate_content' => 
'<xml>Some Other Content</xml>',
   186                 'certificate_hash' => md5(
'<xml>Some Content</xml>'),
   187                 'template_values' => 
'[]',
   189                 'ilias_version' => 
'v5.3.0',
   190                 'created_timestamp' => 123_456_789,
   191                 'currently_active' => 
false,
   192                 'background_image_path' => 
'/some/where/else/background.jpg',
   193                 'thumbnail_image_path' => 
'some/path/test.svg',
   194                 'background_image_ident' => 
'-',
   195                 'thumbnail_image_ident' => 
'-'   198         $database->method(
'fetchAssoc')->willReturnCallback(
   199             function () use (&$consecutive) {
   200                 return array_shift($consecutive);
   204         $objectDataCache = $this->getMockBuilder(ilObjectDataCache::class)
   205             ->disableOriginalConstructor()
   208         $objectDataCache->method(
'lookUpType')->willReturn(
'crs');
   212         $template = $repository->fetchCurrentlyActiveCertificate(10);
   214         $this->assertSame(1, $template->getId());
 
 
 
 
◆ testFetchFirstCreatedTemplateFailsBecauseNothingWasSaved()
      
        
          | ilCertificateTemplateRepositoryTest::testFetchFirstCreatedTemplateFailsBecauseNothingWasSaved  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 466 of file ilCertificateTemplateRepositoryTest.php.
  468         $this->expectException(ilException::class);
   470         $database = $this->createMock(ilDBInterface::class);
   472         $logger = $this->getMockBuilder(ilLogger::class)
   473             ->disableOriginalConstructor()
   476         $database->method(
'quote')
   477             ->with(10, 
'integer')
   480         $objectDataCache = $this->getMockBuilder(ilObjectDataCache::class)
   481             ->disableOriginalConstructor()
   484         $database->method(
'fetchAssoc')
   487         $database->method(
'fetchAssoc')
   492         $repository->fetchFirstCreatedTemplate(10);
 
 
 
 
◆ testFetchPreviousCertificate()
      
        
          | ilCertificateTemplateRepositoryTest::testFetchPreviousCertificate  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 217 of file ilCertificateTemplateRepositoryTest.php.
  219         $logger = $this->getMockBuilder(ilLogger::class)
   220             ->disableOriginalConstructor()
   223         $database = $this->createMock(ilDBInterface::class);
   229                     'certificate_content' => 
'<xml>Some Content</xml>',
   230                     'certificate_hash' => md5(
'<xml>Some Content</xml>'),
   231                     'template_values' => 
'[]',
   233                     'ilias_version' => 
'v5.4.0',
   234                     'created_timestamp' => 123_456_789,
   235                     'currently_active' => 
true,
   236                     'background_image_path' => 
'/some/where/background.jpg',
   237                     'thumbnail_image_path' => 
'some/path/test.svg',
   238                     'background_image_ident' => 
'-',
   239                     'thumbnail_image_ident' => 
'-'   245                     'certificate_content' => 
'<xml>Some Other Content</xml>',
   246                     'certificate_hash' => md5(
'<xml>Some Content</xml>'),
   247                     'template_values' => 
'[]',
   249                     'ilias_version' => 
'v5.3.0',
   250                     'created_timestamp' => 123_456_789,
   251                     'currently_active' => 
false,
   252                     'background_image_path' => 
'/some/where/else/background.jpg',
   253                     'thumbnail_image_path' => 
'some/path/test.svg',
   254                     'background_image_ident' => 
'-',
   255                     'thumbnail_image_ident' => 
'-'   258         $database->method(
'fetchAssoc')->willReturnCallback(
   259             function () use (&$consecutive) {
   260                 return array_shift($consecutive);
   264         $objectDataCache = $this->getMockBuilder(ilObjectDataCache::class)
   265             ->disableOriginalConstructor()
   268         $objectDataCache->method(
'lookUpType')->willReturn(
'crs');
   272         $template = $repository->fetchPreviousCertificate(10);
   274         $this->assertSame(30, $template->getId());
 
 
 
 
The documentation for this class was generated from the following file: