Skip to content

Commit 5fb784e

Browse files
kghblnmwjames
authored andcommitted
Fix "Call to undefined method ... getCachedPropertyValuesPrefetcher" for SWM 3.1+ (#28)
[skip ci]
1 parent 3ed6811 commit 5fb784e

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/ChangeNotification/ChangeNotificationFilter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ private function doFilterOnFieldChangeOps( $property, $tableChangeOp, $fieldChan
263263

264264
private function doCompareNotificationsOnValuesWithOps( $property, $dataItem, $fieldChangeOp ) {
265265

266-
$cachedPropertyValuesPrefetcher = ApplicationFactory::getInstance()->getCachedPropertyValuesPrefetcher();
266+
$propertySpecificationLookup = ApplicationFactory::getInstance()->getPropertySpecificationLookup();
267267

268268
// Don't mix !!
269269
// Either use the plain annotation style via [[Notifications on:: ...]] OR
@@ -273,7 +273,7 @@ private function doCompareNotificationsOnValuesWithOps( $property, $dataItem, $f
273273
// |Notifications on=...
274274
// |Notifications to group=...
275275
// }}
276-
if ( ( $pv = $cachedPropertyValuesPrefetcher->getPropertyValues( $dataItem, $property ) ) !== array() ) {
276+
if ( ( $pv = $propertySpecificationLookup->getSpecification( $dataItem, $property ) ) !== array() ) {
277277
return $this->doCompareOnPropertyValues( $dataItem, $pv, $fieldChangeOp );
278278
}
279279

tests/phpunit/Unit/ChangeNotification/ChangeNotificationFilterTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
class ChangeNotificationFilterTest extends \PHPUnit_Framework_TestCase {
2020

2121
private $store;
22-
private $cachedPropertyValuesPrefetcher;
22+
private $propertySpecificationLookup;
2323
private $testEnvironment;
2424

2525
protected function setUp() {
@@ -28,14 +28,14 @@ protected function setUp() {
2828
->disableOriginalConstructor()
2929
->getMock();
3030

31-
$this->cachedPropertyValuesPrefetcher = $this->getMockBuilder( '\SMW\CachedPropertyValuesPrefetcher' )
31+
$this->propertySpecificationLookup = $this->getMockBuilder( '\SMW\PropertySpecificationLookup' )
3232
->disableOriginalConstructor()
3333
->getMock();
3434

3535
$this->testEnvironment = new TestEnvironment();
3636

3737
$this->testEnvironment->registerObject( 'Store', $this->store );
38-
$this->testEnvironment->registerObject( 'CachedPropertyValuesPrefetcher', $this->cachedPropertyValuesPrefetcher );
38+
$this->testEnvironment->registerObject( 'PropertySpecificationLookup', $this->propertySpecificationLookup );
3939
}
4040

4141
protected function tearDown() {
@@ -220,8 +220,8 @@ public function testhasChangeToNotifyAbout_ChangeNotificationForAnyValue() {
220220
->method( 'getObjectIds' )
221221
->will( $this->returnValue( $idTable ) );
222222

223-
$this->cachedPropertyValuesPrefetcher->expects( $this->any() )
224-
->method( 'getPropertyValues' )
223+
$this->propertySpecificationLookup->expects( $this->any() )
224+
->method( 'getSpecification' )
225225
->will( $this->returnValue( array( new DIBlob( '+' ) ) ) ); //Any value
226226

227227
$compositePropertyTableDiffIterator = $this->getMockBuilder( '\SMW\SQLStore\CompositePropertyTableDiffIterator' )
@@ -293,8 +293,8 @@ public function testhasChangeToNotifyAbout_ChangeNotificationForDistinctValue()
293293
->method( 'getObjectIds' )
294294
->will( $this->returnValue( $idTable ) );
295295

296-
$this->cachedPropertyValuesPrefetcher->expects( $this->any() )
297-
->method( 'getPropertyValues' )
296+
$this->propertySpecificationLookup->expects( $this->any() )
297+
->method( 'getSpecification' )
298298
->will( $this->returnValue( array( new DIBlob( 'DistinctText' ) ) ) ); //Distinct value
299299

300300
$compositePropertyTableDiffIterator = $this->getMockBuilder( '\SMW\SQLStore\CompositePropertyTableDiffIterator' )
@@ -362,8 +362,8 @@ public function testhasChangeToNotifyAbout_ChangeNotificationForPageValue() {
362362
->method( 'getObjectIds' )
363363
->will( $this->returnValue( $idTable ) );
364364

365-
$this->cachedPropertyValuesPrefetcher->expects( $this->any() )
366-
->method( 'getPropertyValues' )
365+
$this->propertySpecificationLookup->expects( $this->any() )
366+
->method( 'getSpecification' )
367367
->will( $this->returnValue( array( new DIBlob( 'BAR' ) ) ) ); //Distinct value
368368

369369
$compositePropertyTableDiffIterator = $this->getMockBuilder( '\SMW\SQLStore\CompositePropertyTableDiffIterator' )
@@ -461,8 +461,8 @@ public function testhasChangeToNotifyAbout_ChangeNotificationForSubobjectRelated
461461
->with( $this->equalTo( $dataItem ) )
462462
->will( $this->returnValue( $semanticData ) );
463463

464-
$this->cachedPropertyValuesPrefetcher->expects( $this->any() )
465-
->method( 'getPropertyValues' )
464+
$this->propertySpecificationLookup->expects( $this->any() )
465+
->method( 'getSpecification' )
466466
->will( $this->returnValue( array() ) );
467467

468468
$compositePropertyTableDiffIterator = $this->getMockBuilder( '\SMW\SQLStore\CompositePropertyTableDiffIterator' )

0 commit comments

Comments
 (0)