Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 29... Línea 29...
29
class context_test extends \advanced_testcase {
29
class context_test extends \advanced_testcase {
30
    /**
30
    /**
31
     * Tests legacy class name.
31
     * Tests legacy class name.
32
     * @coversNothing
32
     * @coversNothing
33
     */
33
     */
34
    public function test_legacy_classname() {
34
    public function test_legacy_classname(): void {
35
        $this->assertSame('core\context', context::class);
35
        $this->assertSame('core\context', context::class);
Línea 36... Línea 36...
36
 
36
 
37
        $context = \context_system::instance();
37
        $context = \context_system::instance();
38
        $this->assertInstanceOf(context::class, $context);
38
        $this->assertInstanceOf(context::class, $context);
Línea 41... Línea 41...
41
 
41
 
42
    /**
42
    /**
43
     * Tests covered method.
43
     * Tests covered method.
44
     * @covers ::instance_by_id
44
     * @covers ::instance_by_id
45
     */
45
     */
46
    public function test_factory_methods() {
46
    public function test_factory_methods(): void {
47
        $context = context::instance_by_id(SYSCONTEXTID);
47
        $context = context::instance_by_id(SYSCONTEXTID);
48
        $this->assertSame('core\\context\\system', get_class($context));
48
        $this->assertSame('core\\context\\system', get_class($context));
Línea 49... Línea 49...
49
    }
49
    }
50
 
50
 
51
    /**
51
    /**
52
     * Tests covered methods.
52
     * Tests covered methods.
53
     * @covers ::__set
53
     * @covers ::__set
54
     * @covers ::__unset
54
     * @covers ::__unset
55
     */
55
     */
Línea 56... Línea 56...
56
    public function test_propery_change_protection() {
56
    public function test_propery_change_protection(): void {
57
        $context = context\system::instance();
57
        $context = context\system::instance();
58
 
58
 
Línea 77... Línea 77...
77
 
77
 
78
    /**
78
    /**
79
     * Tests covered method.
79
     * Tests covered method.
80
     * @covers ::__get
80
     * @covers ::__get
81
     */
81
     */
82
    public function test_incorrect_property() {
82
    public function test_incorrect_property(): void {
Línea 83... Línea 83...
83
        $context = context\system::instance();
83
        $context = context\system::instance();
84
 
84
 
85
        $a = $context->whatever;
85
        $a = $context->whatever;
Línea 86... Línea 86...
86
        $this->assertDebuggingCalled('Invalid context property accessed! whatever');
86
        $this->assertDebuggingCalled('Invalid context property accessed! whatever');
87
    }
87
    }
88
 
88
 
89
    /**
89
    /**
90
     * Tests covered method.
90
     * Tests covered method.
91
     * @covers ::getIterator
91
     * @covers ::getIterator
92
     */
92
     */
93
    public function test_iterator() {
93
    public function test_iterator(): void {
94
        $context = context\system::instance();
94
        $context = context\system::instance();
95
        $array = iterator_to_array($context->getIterator());
95
        $array = iterator_to_array($context->getIterator());