From 73214234ed310cac35147adc89ffc1d84a9bbdf4 Mon Sep 17 00:00:00 2001 From: paladox Date: Sun, 23 Feb 2025 13:20:12 +0000 Subject: [PATCH 1/2] Fix CI --- SemanticCite.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SemanticCite.php b/SemanticCite.php index 3fc848e..0a874be 100644 --- a/SemanticCite.php +++ b/SemanticCite.php @@ -2,7 +2,7 @@ use SCI\HookRegistry; use SCI\Options; -use SMW\ApplicationFactory; +use SMW\Services\ServicesFactory as ApplicationFactory; /** * @see https://github.com/SemanticMediaWiki/SemanticCite/ From 39de7ff24a8626ff96deb8d40e34d3f613379cde Mon Sep 17 00:00:00 2001 From: paladox Date: Sun, 23 Feb 2025 13:41:29 +0000 Subject: [PATCH 2/2] Fix --- src/CitationResourceMatchFinder.php | 8 +++++--- src/CitationTextChangeUpdateJobDispatcher.php | 10 +++++----- src/DataValues/CitationReferenceValue.php | 2 +- .../ResourceIdentifierStringValue.php | 2 +- src/HookRegistry.php | 2 +- src/ParserFunctionFactory.php | 2 +- src/ReferenceListFactory.php | 2 +- src/Specials/CitableMetadata/PageBuilder.php | 2 +- src/Specials/SpecialFindCitableMetadata.php | 2 +- .../Unit/CitationResourceMatchFinderTest.php | 2 +- ...tationTextChangeUpdateJobDispatcherTest.php | 18 +++++++++--------- tests/phpunit/Unit/HookRegistryTest.php | 4 ++-- .../Unit/ReferenceBacklinksLookupTest.php | 2 +- 13 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/CitationResourceMatchFinder.php b/src/CitationResourceMatchFinder.php index 16c9b2d..ecb4ba5 100644 --- a/src/CitationResourceMatchFinder.php +++ b/src/CitationResourceMatchFinder.php @@ -7,10 +7,12 @@ use SMW\Query\PrintRequest; use SMW\Store; use SMW\DIProperty; -use SMWPropertyValue as PropertyValue; +use SMW\DataValues\PropertyValue; use SMWQuery as Query; use SMWDIBlob as DIBlob; use SMW\DataValueFactory; +use SMW\Query\QueryResult; +use SMWInfolink; use SCI\DataValues\ResourceIdentifierFactory; /** @@ -60,7 +62,7 @@ public function findCitationResourceLinks( array $subjects, $linkClass = '', $ca null ); - $browselink = \SMWInfolink::newBrowsingLink( + $browselink = SMWInfolink::newBrowsingLink( $caption, $dataValue->getWikiValue(), $linkClass @@ -135,7 +137,7 @@ public function findCitationTextFor( $citationReference ) { $citationReference ); - if ( !$queryResult instanceof \SMWQueryResult ) { + if ( !$queryResult instanceof QueryResult ) { return [ $subjects, $text ]; } diff --git a/src/CitationTextChangeUpdateJobDispatcher.php b/src/CitationTextChangeUpdateJobDispatcher.php index 9a4e153..2fed3bd 100644 --- a/src/CitationTextChangeUpdateJobDispatcher.php +++ b/src/CitationTextChangeUpdateJobDispatcher.php @@ -5,9 +5,9 @@ use SMW\Store; use SMW\DIProperty; use SMW\DIWikiPage; -use SMW\ApplicationFactory; +use SMW\Services\ServicesFactory as ApplicationFactory; use SMW\HashBuilder; -use SMW\SQLStore\CompositePropertyTableDiffIterator; +use SMW\SQLStore\ChangeOp\ChangeOp; /** * If a citation text was altered then lookup related references on pages used @@ -59,11 +59,11 @@ public function setEnabledUpdateJobState( $enabledUpdateJobState ) { * @since 1.0 * * @param DIWikiPage $subject - * @param CompositePropertyTableDiffIterator $compositePropertyTableDiffIterator + * @param ChangeOp $changeOp * * @return boolean */ - public function dispatchUpdateJobFor( DIWikiPage $subject, CompositePropertyTableDiffIterator $compositePropertyTableDiffIterator ) { + public function dispatchUpdateJobFor( DIWikiPage $subject, ChangeOp $changeOp ) { if ( !$this->enabledUpdateJobState ) { return false; @@ -74,7 +74,7 @@ public function dispatchUpdateJobFor( DIWikiPage $subject, CompositePropertyTabl ); $subjectIdList = $this->getSubjectListFrom( - $compositePropertyTableDiffIterator->getOrderedDiffByTable( $tableName ) + $changeOp->getOrderedDiffByTable( $tableName ) ); if ( ( $jobList = $this->getDispatchableTargetList( $subjectIdList ) ) === [] ) { diff --git a/src/DataValues/CitationReferenceValue.php b/src/DataValues/CitationReferenceValue.php index b73eab4..051a054 100644 --- a/src/DataValues/CitationReferenceValue.php +++ b/src/DataValues/CitationReferenceValue.php @@ -3,7 +3,7 @@ namespace SCI\DataValues; use SCI\CitationReferencePositionJournal; -use SMWStringValue as StringValue; +use SMW\DataValues\StringValue; use SMWDIBlob as DIBlob; use Html; diff --git a/src/DataValues/ResourceIdentifierStringValue.php b/src/DataValues/ResourceIdentifierStringValue.php index a78bdef..6ce0e7b 100644 --- a/src/DataValues/ResourceIdentifierStringValue.php +++ b/src/DataValues/ResourceIdentifierStringValue.php @@ -2,7 +2,7 @@ namespace SCI\DataValues; -use SMWStringValue as StringValue; +use SMW\DataValues\StringValue; use SMWDIBlob as DIBlob; use Html; diff --git a/src/HookRegistry.php b/src/HookRegistry.php index af80767..656b62f 100644 --- a/src/HookRegistry.php +++ b/src/HookRegistry.php @@ -4,7 +4,7 @@ use SMW\Store; use Onoi\Cache\Cache; -use SMW\ApplicationFactory; +use SMW\Services\ServicesFactory as ApplicationFactory; use SMW\DataTypeRegistry; use SMW\DIWikiPage; use SMWDataItem as DataItem; diff --git a/src/ParserFunctionFactory.php b/src/ParserFunctionFactory.php index 57c8b2b..df24315 100644 --- a/src/ParserFunctionFactory.php +++ b/src/ParserFunctionFactory.php @@ -2,7 +2,7 @@ namespace SCI; -use SMW\ApplicationFactory; +use SMW\Services\ServicesFactory as ApplicationFactory; use SMW\NamespaceExaminer; use SMW\ParameterProcessorFactory; use SCI\Bibtex\BibtexProcessor; diff --git a/src/ReferenceListFactory.php b/src/ReferenceListFactory.php index cee0d70..dd0ad8d 100644 --- a/src/ReferenceListFactory.php +++ b/src/ReferenceListFactory.php @@ -4,7 +4,7 @@ use SMW\Store; use SMW\NamespaceExaminer; -use SMW\ApplicationFactory; +use SMW\Services\ServicesFactory as ApplicationFactory; use Onoi\Cache\Cache; use Parser; diff --git a/src/Specials/CitableMetadata/PageBuilder.php b/src/Specials/CitableMetadata/PageBuilder.php index cab06c2..2b52849 100644 --- a/src/Specials/CitableMetadata/PageBuilder.php +++ b/src/Specials/CitableMetadata/PageBuilder.php @@ -2,7 +2,7 @@ namespace SCI\Specials\CitableMetadata; -use SMW\ApplicationFactory; +use SMW\Services\ServicesFactory as ApplicationFactory; use SCI\CitationResourceMatchFinder; use SMW\MediaWiki\Renderer\HtmlFormRenderer; use SMW\MediaWiki\Renderer\HtmlColumnListRenderer; diff --git a/src/Specials/SpecialFindCitableMetadata.php b/src/Specials/SpecialFindCitableMetadata.php index b0cb062..2322a0b 100644 --- a/src/Specials/SpecialFindCitableMetadata.php +++ b/src/Specials/SpecialFindCitableMetadata.php @@ -4,7 +4,7 @@ use MediaWiki\MediaWikiServices; use SpecialPage; -use SMW\ApplicationFactory; +use SMW\Services\ServicesFactory as ApplicationFactory; use Onoi\HttpRequest\HttpRequestFactory; use SCI\FilteredMetadata\HttpResponseParserFactory; use SCI\CitationResourceMatchFinder; diff --git a/tests/phpunit/Unit/CitationResourceMatchFinderTest.php b/tests/phpunit/Unit/CitationResourceMatchFinderTest.php index 08baa95..3113261 100644 --- a/tests/phpunit/Unit/CitationResourceMatchFinderTest.php +++ b/tests/phpunit/Unit/CitationResourceMatchFinderTest.php @@ -32,7 +32,7 @@ public function testCanConstruct() { */ public function testFindMatchForUidTypeOf( $key, $id ) { - $queryResult = $this->getMockBuilder( '\SMWQueryResult' ) + $queryResult = $this->getMockBuilder( '\SMW\Query\QueryResult' ) ->disableOriginalConstructor() ->getMock(); diff --git a/tests/phpunit/Unit/CitationTextChangeUpdateJobDispatcherTest.php b/tests/phpunit/Unit/CitationTextChangeUpdateJobDispatcherTest.php index 37a7b9a..66f4bbc 100644 --- a/tests/phpunit/Unit/CitationTextChangeUpdateJobDispatcherTest.php +++ b/tests/phpunit/Unit/CitationTextChangeUpdateJobDispatcherTest.php @@ -50,16 +50,16 @@ public function testDisabledDispatchJob() { $instance->setEnabledUpdateJobState( false ); - $compositePropertyTableDiffIterator = $this->getMockBuilder( '\SMW\SQLStore\CompositePropertyTableDiffIterator' ) + $changeOp = $this->getMockBuilder( '\SMW\SQLStore\ChangeOp\ChangeOp' ) ->disableOriginalConstructor() ->getMock(); - $compositePropertyTableDiffIterator->expects( $this->never() ) + $changeOp->expects( $this->never() ) ->method( 'getOrderedDiffByTable' ); $subject = DIWikiPage::newFromText( __METHOD__ ); - $instance->dispatchUpdateJobFor( $subject, $compositePropertyTableDiffIterator ); + $instance->dispatchUpdateJobFor( $subject, $changeOp ); } /** @@ -97,18 +97,18 @@ public function testDispatchJobForDiffableChange( $diff ) { $this->referenceBacklinksLookup ); - $compositePropertyTableDiffIterator = $this->getMockBuilder( '\SMW\SQLStore\CompositePropertyTableDiffIterator' ) + $changeOp = $this->getMockBuilder( '\SMW\SQLStore\ChangeOp\ChangeOp' ) ->disableOriginalConstructor() ->getMock(); - $compositePropertyTableDiffIterator->expects( $this->once() ) + $changeOp->expects( $this->once() ) ->method( 'getOrderedDiffByTable' ) ->will( $this->returnValue( $diff ) ); $subject = DIWikiPage::newFromText( __METHOD__ ); $this->assertTrue( - $instance->dispatchUpdateJobFor( $subject, $compositePropertyTableDiffIterator ) + $instance->dispatchUpdateJobFor( $subject, $changeOp ) ); } @@ -129,18 +129,18 @@ public function testDispatchJobForNoValidDiff() { $this->referenceBacklinksLookup ); - $compositePropertyTableDiffIterator = $this->getMockBuilder( '\SMW\SQLStore\CompositePropertyTableDiffIterator' ) + $changeOp = $this->getMockBuilder( '\SMW\SQLStore\ChangeOp\ChangeOp' ) ->disableOriginalConstructor() ->getMock(); - $compositePropertyTableDiffIterator->expects( $this->once() ) + $changeOp->expects( $this->once() ) ->method( 'getOrderedDiffByTable' ) ->will( $this->returnValue( $diff ) ); $subject = DIWikiPage::newFromText( __METHOD__ ); $this->assertFalse( - $instance->dispatchUpdateJobFor( $subject, $compositePropertyTableDiffIterator ) + $instance->dispatchUpdateJobFor( $subject, $changeOp ) ); } diff --git a/tests/phpunit/Unit/HookRegistryTest.php b/tests/phpunit/Unit/HookRegistryTest.php index d0e6fe5..fb8c8c6 100644 --- a/tests/phpunit/Unit/HookRegistryTest.php +++ b/tests/phpunit/Unit/HookRegistryTest.php @@ -447,13 +447,13 @@ public function doTestRegisteredAfterDataUpdateComplete( $instance ) { ->disableOriginalConstructor() ->getMock(); - $compositePropertyTableDiffIterator = $this->getMockBuilder( '\SMW\SQLStore\CompositePropertyTableDiffIterator' ) + $changeOp = $this->getMockBuilder( '\SMW\SQLStore\ChangeOp\ChangeOp' ) ->disableOriginalConstructor() ->getMock(); $this->assertThatHookIsExcutable( $instance->getHandlerFor( $hook ), - [ $store, $semanticData, $compositePropertyTableDiffIterator ] + [ $store, $semanticData, $changeOp ] ); } diff --git a/tests/phpunit/Unit/ReferenceBacklinksLookupTest.php b/tests/phpunit/Unit/ReferenceBacklinksLookupTest.php index cd47bdd..449ac72 100644 --- a/tests/phpunit/Unit/ReferenceBacklinksLookupTest.php +++ b/tests/phpunit/Unit/ReferenceBacklinksLookupTest.php @@ -120,7 +120,7 @@ public function testAddReferenceBacklinks() { $this->equalTo( new DIProperty( PropertyRegistry::SCI_CITE_REFERENCE ) ), $this->anything() ); - $queryResult = $this->getMockBuilder( '\SMWQueryResult' ) + $queryResult = $this->getMockBuilder( '\SMW\Query\QueryResult' ) ->disableOriginalConstructor() ->getMock();