getMockBuilder('core_kernel_classes_Resource') ->setMockClassName('FakeResource') ->setConstructorArgs([ $uri ]) ->getMock(); return $resourceMock; } /** * * @author Lionel Lecaque, lionel@taotesting.com */ public function testGetAuthoringUrl() { $fakeUri = 'http://fakens.rdf#fakeItemUri'; $model = new TestModelService(); $resourceMock = $this->getResourceMock($fakeUri); $resourceMock->expects($this->once()) ->method('getUri') ->will($this->returnValue($fakeUri)); $url = $model->getAuthoringUrl($resourceMock); $this->assertEquals(1, preg_match('/uri=' . urlencode($fakeUri) . '/', $url)); } /** * Verify that TestModel import handlers are known and tested */ public function testTestModelImportHandlers() { $model = new TestModelService(['importHandlers' => [ new \taoQtiTest_models_classes_import_TestImport() ]]); $handlers = $model->getImportHandlers(); $this->assertCount(1, $handlers); $handler = reset($handlers); $this->assertInstanceOf('taoQtiTest_models_classes_import_TestImport', $handler); } /** * Verify that TestModel export handlers are known and tested */ public function testTestModelExportHandlers() { $model = new TestModelService(['exportHandlers' => [ new \taoQtiTest_models_classes_export_TestExport() ]]); $handlers = $model->getExportHandlers(); $this->assertCount(1, $handlers); $handler = reset($handlers); $this->assertInstanceOf('taoQtiTest_models_classes_export_TestExport', $handler); } }