| Línea 69... | 
            Línea 69... | 
          
          
            | 69 | 
                    $this->validdata = array('stringA' => 'A string', 'stringAformat' => FORMAT_HTML, 'intB' => 4);
  | 
            69 | 
                    $this->validdata = array('stringA' => 'A string', 'stringAformat' => FORMAT_HTML, 'intB' => 4);
  | 
          
          
            | Línea 70... | 
            Línea 70... | 
          
          
            | 70 | 
             
  | 
            70 | 
             
  | 
          
          
            | 71 | 
                    $this->invaliddata = array('stringA' => 'A string');
  | 
            71 | 
                    $this->invaliddata = array('stringA' => 'A string');
  | 
          
          
            | Línea 72... | 
            Línea 72... | 
          
          
            | 72 | 
                }
  | 
            72 | 
                }
  | 
          
          
            | 73 | 
             
  | 
            73 | 
             
  | 
          
          
            | Línea 74... | 
            Línea 74... | 
          
          
            | 74 | 
                public function test_get_read_structure() {
  | 
            74 | 
                public function test_get_read_structure(): void {
  | 
          
          
            | 75 | 
                    $structure = core_testable_exporter::get_read_structure();
  | 
            75 | 
                    $structure = core_testable_exporter::get_read_structure();
  | 
          
          
            | 76 | 
             
  | 
            76 | 
             
  | 
          
          
            | 77 | 
                    $this->assertInstanceOf(external_single_structure::class, $structure);
  | 
            77 | 
                    $this->assertInstanceOf(external_single_structure::class, $structure);
  | 
          
          
            | 78 | 
                    $this->assertInstanceOf(external_value::class, $structure->keys['stringA']);
  | 
            78 | 
                    $this->assertInstanceOf(external_value::class, $structure->keys['stringA']);
  | 
          
          
            | 79 | 
                    $this->assertInstanceOf(external_format_value::class, $structure->keys['stringAformat']);
  | 
            79 | 
                    $this->assertInstanceOf(external_format_value::class, $structure->keys['stringAformat']);
  | 
          
          
            | 80 | 
                    $this->assertInstanceOf(external_value::class, $structure->keys['intB']);
  | 
            80 | 
                    $this->assertInstanceOf(external_value::class, $structure->keys['intB']);
  | 
          
          
            | Línea 81... | 
            Línea 81... | 
          
          
            | 81 | 
                    $this->assertInstanceOf(external_value::class, $structure->keys['otherstring']);
  | 
            81 | 
                    $this->assertInstanceOf(external_value::class, $structure->keys['otherstring']);
  | 
          
          
            | 82 | 
                    $this->assertInstanceOf(external_multiple_structure::class, $structure->keys['otherstrings']);
  | 
            82 | 
                    $this->assertInstanceOf(external_multiple_structure::class, $structure->keys['otherstrings']);
  | 
          
          
            | Línea 83... | 
            Línea 83... | 
          
          
            | 83 | 
                }
  | 
            83 | 
                }
  | 
          
          
            | 84 | 
             
  | 
            84 | 
             
  | 
          
          
            | 85 | 
                public function test_get_create_structure() {
  | 
            85 | 
                public function test_get_create_structure(): void {
  | 
          
          
            | 86 | 
                    $structure = core_testable_exporter::get_create_structure();
  | 
            86 | 
                    $structure = core_testable_exporter::get_create_structure();
  | 
          
          
            | 87 | 
             
  | 
            87 | 
             
  | 
          
          
            | 88 | 
                    $this->assertInstanceOf(external_single_structure::class, $structure);
  | 
            88 | 
                    $this->assertInstanceOf(external_single_structure::class, $structure);
  | 
          
          
            | 89 | 
                    $this->assertInstanceOf(external_value::class, $structure->keys['stringA']);
  | 
            89 | 
                    $this->assertInstanceOf(external_value::class, $structure->keys['stringA']);
  | 
          
          
            | Línea 90... | 
            Línea 90... | 
          
          
            | 90 | 
                    $this->assertInstanceOf(external_format_value::class, $structure->keys['stringAformat']);
  | 
            90 | 
                    $this->assertInstanceOf(external_format_value::class, $structure->keys['stringAformat']);
  | 
          
          
            | 91 | 
                    $this->assertInstanceOf(external_value::class, $structure->keys['intB']);
  | 
            91 | 
                    $this->assertInstanceOf(external_value::class, $structure->keys['intB']);
  | 
          
          
            | Línea 92... | 
            Línea 92... | 
          
          
            | 92 | 
                    $this->assertArrayNotHasKey('otherstring', $structure->keys);
  | 
            92 | 
                    $this->assertArrayNotHasKey('otherstring', $structure->keys);
  | 
          
          
            | 93 | 
                    $this->assertArrayNotHasKey('otherstrings', $structure->keys);
  | 
            93 | 
                    $this->assertArrayNotHasKey('otherstrings', $structure->keys);
  | 
          
          
            | 94 | 
                }
  | 
            94 | 
                }
  | 
          
          
            | 95 | 
             
  | 
            95 | 
             
  | 
          
          
            | 96 | 
                public function test_get_update_structure() {
  | 
            96 | 
                public function test_get_update_structure(): void {
  | 
          
          
            | 97 | 
                    $structure = core_testable_exporter::get_update_structure();
  | 
            97 | 
                    $structure = core_testable_exporter::get_update_structure();
  | 
          
          
            | 98 | 
             
  | 
            98 | 
             
  | 
          
          
            | Línea 99... | 
            Línea 99... | 
          
          
            | 99 | 
                    $this->assertInstanceOf(external_single_structure::class, $structure);
  | 
            99 | 
                    $this->assertInstanceOf(external_single_structure::class, $structure);
  | 
          
          
            | 100 | 
                    $this->assertInstanceOf(external_value::class, $structure->keys['stringA']);
  | 
            100 | 
                    $this->assertInstanceOf(external_value::class, $structure->keys['stringA']);
  | 
          
          
            | 101 | 
                    $this->assertInstanceOf(external_format_value::class, $structure->keys['stringAformat']);
  | 
            101 | 
                    $this->assertInstanceOf(external_format_value::class, $structure->keys['stringAformat']);
  | 
          
          
            | 102 | 
                    $this->assertInstanceOf(external_value::class, $structure->keys['intB']);
  | 
            102 | 
                    $this->assertInstanceOf(external_value::class, $structure->keys['intB']);
  | 
          
          
            | Línea 103... | 
            Línea 103... | 
          
          
            | 103 | 
                    $this->assertArrayNotHasKey('otherstring', $structure->keys);
  | 
            103 | 
                    $this->assertArrayNotHasKey('otherstring', $structure->keys);
  | 
          
          
            | 104 | 
                    $this->assertArrayNotHasKey('otherstrings', $structure->keys);
  | 
            104 | 
                    $this->assertArrayNotHasKey('otherstrings', $structure->keys);
  | 
          
          
            | 105 | 
                }
  | 
            105 | 
                }
  | 
          
          
            | 106 | 
             
  | 
            106 | 
             
  | 
          
          
            | 107 | 
                public function test_invalid_data() {
  | 
            107 | 
                public function test_invalid_data(): void {
  | 
          
          
            | Línea 108... | 
            Línea 108... | 
          
          
            | 108 | 
                    global $PAGE;
  | 
            108 | 
                    global $PAGE;
  | 
          
          
            | 109 | 
                    $exporter = new core_testable_exporter($this->invaliddata, $this->validrelated);
  | 
            109 | 
                    $exporter = new core_testable_exporter($this->invaliddata, $this->validrelated);
  | 
          
          
            | 110 | 
                    $output = $PAGE->get_renderer('core');
  | 
            110 | 
                    $output = $PAGE->get_renderer('core');
  | 
          
          
            | 111 | 
             
  | 
            111 | 
             
  | 
          
          
            | 112 | 
                    // The exception message is a bit misleading, it actually indicates an expected property wasn't found.
  | 
            112 | 
                    // The exception message is a bit misleading, it actually indicates an expected property wasn't found.
  | 
          
          
            | 113 | 
                    $this->expectException(\coding_exception::class);
  | 
            113 | 
                    $this->expectException(\coding_exception::class);
  | 
          
          
            | Línea 114... | 
            Línea 114... | 
          
          
            | 114 | 
                    $this->expectExceptionMessage('Unexpected property stringAformat');
  | 
            114 | 
                    $this->expectExceptionMessage('Unexpected property stringAformat');
  | 
          
          
            | 115 | 
                    $result = $exporter->export($output);
  | 
            115 | 
                    $result = $exporter->export($output);
  | 
          
          
            | Línea 116... | 
            Línea 116... | 
          
          
            | 116 | 
                }
  | 
            116 | 
                }
  | 
          
          
            | 117 | 
             
  | 
            117 | 
             
  | 
          
          
            | 118 | 
                public function test_invalid_related() {
  | 
            118 | 
                public function test_invalid_related(): void {
  | 
          
          
            | Línea 137... | 
            Línea 137... | 
          
          
            | 137 | 
                            $this->assertNotFalse(strpos($e->getMessage(), $key));
  | 
            137 | 
                            $this->assertNotFalse(strpos($e->getMessage(), $key));
  | 
          
          
            | 138 | 
                        }
  | 
            138 | 
                        }
  | 
          
          
            | 139 | 
                    }
  | 
            139 | 
                    }
  | 
          
          
            | 140 | 
                }
  | 
            140 | 
                }
  | 
          
          
            | Línea 141... | 
            Línea 141... | 
          
          
            | 141 | 
             
  | 
            141 | 
             
  | 
          
          
            | 142 | 
                public function test_valid_data_and_related() {
  | 
            142 | 
                public function test_valid_data_and_related(): void {
  | 
          
          
            | 143 | 
                    global $PAGE;
  | 
            143 | 
                    global $PAGE;
  | 
          
          
            | 144 | 
                    $output = $PAGE->get_renderer('core');
  | 
            144 | 
                    $output = $PAGE->get_renderer('core');
  | 
          
          
            | 145 | 
                    $exporter = new core_testable_exporter($this->validdata, $this->validrelated);
  | 
            145 | 
                    $exporter = new core_testable_exporter($this->validdata, $this->validrelated);
  | 
          
          
            | 146 | 
                    $result = $exporter->export($output);
  | 
            146 | 
                    $result = $exporter->export($output);
  | 
          
          
            | 147 | 
                    $this->assertSame('>Another string', $result->otherstring);
  | 
            147 | 
                    $this->assertSame('>Another string', $result->otherstring);
  | 
          
          
            | 148 | 
                    $this->assertSame(array('String >a', 'String b'), $result->otherstrings);
  | 
            148 | 
                    $this->assertSame(array('String >a', 'String b'), $result->otherstrings);
  | 
          
          
            | Línea 149... | 
            Línea 149... | 
          
          
            | 149 | 
                }
  | 
            149 | 
                }
  | 
          
          
            | 150 | 
             
  | 
            150 | 
             
  | 
          
          
            | Línea 151... | 
            Línea 151... | 
          
          
            | 151 | 
                public function test_format_text() {
  | 
            151 | 
                public function test_format_text(): void {
  | 
          
          
            | 152 | 
                    global $PAGE;
  | 
            152 | 
                    global $PAGE;
  | 
          
          
            | 153 | 
             
  | 
            153 | 
             
  | 
          
          
            | Línea 187... | 
            Línea 187... | 
          
          
            | 187 | 
                    $expected = "<p><strong>Watch out:</strong> $youtube <a href=\"$fileurl\" class=\"_blanktarget\">$fileurl</a></p>\n";
  | 
            187 | 
                    $expected = "<p><strong>Watch out:</strong> $youtube <a href=\"$fileurl\" class=\"_blanktarget\">$fileurl</a></p>\n";
  | 
          
          
            | 188 | 
                    $this->assertEquals($expected, $result->stringA);
  | 
            188 | 
                    $this->assertEquals($expected, $result->stringA);
  | 
          
          
            | 189 | 
                    $this->assertEquals(FORMAT_HTML, $result->stringAformat);
  | 
            189 | 
                    $this->assertEquals(FORMAT_HTML, $result->stringAformat);
  | 
          
          
            | 190 | 
                }
  | 
            190 | 
                }
  | 
          
          
            | Línea 191... | 
            Línea 191... | 
          
          
            | 191 | 
             
  | 
            191 | 
             
  | 
          
          
            | 192 | 
                public function test_properties_description() {
  | 
            192 | 
                public function test_properties_description(): void {
  | 
          
          
            | 193 | 
                    $properties = core_testable_exporter::read_properties_definition();
  | 
            193 | 
                    $properties = core_testable_exporter::read_properties_definition();
  | 
          
          
            | 194 | 
                    // Properties default description.
  | 
            194 | 
                    // Properties default description.
  | 
          
          
            | 195 | 
                    $this->assertEquals('stringA', $properties['stringA']['description']);
  | 
            195 | 
                    $this->assertEquals('stringA', $properties['stringA']['description']);
  | 
          
          
            | 196 | 
                    $this->assertEquals('stringAformat', $properties['stringAformat']['description']);
  | 
            196 | 
                    $this->assertEquals('stringAformat', $properties['stringAformat']['description']);
  |