88 : void
89 {
90 $title = 'Revision One';
91 $file_stream = Streams::ofString('Test Content');
92
93 $this->storage_mock->expects($this->any())
94 ->method('manage')
95 ->willReturn($this->manager_mock);
96
97
99 $r = new ReflectionClass(ilObjFile::class);
100 $property = $r->getProperty('just_notified');
101 $property->setAccessible(true);
102 $property->setValue($file, true);
104 $this->db_mock->expects($this->any())
105 ->method('fetchAssoc')
106 ->willReturn(
107 [
108 'last_update' => '',
109 'create_date' => ''
110 ]
111 );
112 $file->create();
113
114
116
117 $this->manager_mock->expects($this->any())
118 ->method('find')
119 ->withConsecutive(['-'], ['the_identification'], ['the_identification'])
120 ->willReturnOnConsecutiveCalls(null, $rid, $rid);
121
122 $this->manager_mock->expects($this->once())
123 ->method('stream')
125 ->willReturn($rid);
126
128 $revision->setVersionNumber(1);
129 $revision->setTitle($title);
131 $resource->addRevision($revision);
132
133 $this->manager_mock->expects($this->once())
134 ->method('getCurrentRevision')
135 ->with($rid)
136 ->willReturn($revision);
137
138
139 $this->manager_mock->expects($this->any())
140 ->method('getResource')
141 ->with($rid)
142 ->willReturn($resource);
143
144 $revision_number = $file->appendStream($file_stream, $title);
145 $this->assertEquals(1, $revision_number);
146 $this->assertEquals(1, $file->getVersion());
147 $this->assertEquals($title, $file->getTitle());
148 }
Class ResourceIdentification.
Class StorableFileResource.
Class ilObjFileStakeholder.