diff options
Diffstat (limited to 'tests')
62 files changed, 586 insertions, 765 deletions
diff --git a/tests/app/Census/CensusColumnConditionCanadaMarriedSingleTest.php b/tests/app/Census/CensusColumnConditionCanadaMarriedSingleTest.php index bf09de27a4..691081438b 100644 --- a/tests/app/Census/CensusColumnConditionCanadaMarriedSingleTest.php +++ b/tests/app/Census/CensusColumnConditionCanadaMarriedSingleTest.php @@ -107,7 +107,7 @@ class CensusColumnConditionCanadaMarriedSingleTest extends TestCase $spouse->method('getDeathDate')->willReturn(new Date('1820')); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family->expects(self::exactly(2)) ->method('facts') ->with(self::withConsecutive([['MARR'], ['DIV']])) @@ -115,7 +115,7 @@ class CensusColumnConditionCanadaMarriedSingleTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('M'); @@ -137,7 +137,7 @@ class CensusColumnConditionCanadaMarriedSingleTest extends TestCase $spouse->method('getDeathDate')->willReturn(new Date('1820')); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -146,7 +146,7 @@ class CensusColumnConditionCanadaMarriedSingleTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('F'); @@ -241,7 +241,7 @@ class CensusColumnConditionCanadaMarriedSingleTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -268,7 +268,7 @@ class CensusColumnConditionCanadaMarriedSingleTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -295,7 +295,7 @@ class CensusColumnConditionCanadaMarriedSingleTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -322,7 +322,7 @@ class CensusColumnConditionCanadaMarriedSingleTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') diff --git a/tests/app/Census/CensusColumnConditionCanadaMarriedWidowedTest.php b/tests/app/Census/CensusColumnConditionCanadaMarriedWidowedTest.php index 2954d51ad7..fa82a68276 100644 --- a/tests/app/Census/CensusColumnConditionCanadaMarriedWidowedTest.php +++ b/tests/app/Census/CensusColumnConditionCanadaMarriedWidowedTest.php @@ -107,7 +107,7 @@ class CensusColumnConditionCanadaMarriedWidowedTest extends TestCase $spouse->method('getDeathDate')->willReturn(new Date('1820')); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family->expects(self::exactly(2)) ->method('facts') ->with(self::withConsecutive([['MARR'], ['DIV']])) @@ -115,7 +115,7 @@ class CensusColumnConditionCanadaMarriedWidowedTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('M'); @@ -137,7 +137,7 @@ class CensusColumnConditionCanadaMarriedWidowedTest extends TestCase $spouse->method('getDeathDate')->willReturn(new Date('1820')); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -146,7 +146,7 @@ class CensusColumnConditionCanadaMarriedWidowedTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('F'); @@ -241,7 +241,7 @@ class CensusColumnConditionCanadaMarriedWidowedTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -268,7 +268,7 @@ class CensusColumnConditionCanadaMarriedWidowedTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -295,7 +295,7 @@ class CensusColumnConditionCanadaMarriedWidowedTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -322,7 +322,7 @@ class CensusColumnConditionCanadaMarriedWidowedTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') diff --git a/tests/app/Census/CensusColumnConditionCanadaTest.php b/tests/app/Census/CensusColumnConditionCanadaTest.php index 74493771f9..f62e67b740 100644 --- a/tests/app/Census/CensusColumnConditionCanadaTest.php +++ b/tests/app/Census/CensusColumnConditionCanadaTest.php @@ -107,7 +107,7 @@ class CensusColumnConditionCanadaTest extends TestCase $spouse->method('getDeathDate')->willReturn(new Date('1820')); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family->expects(self::exactly(2)) ->method('facts') ->with(self::withConsecutive([['MARR'], ['DIV']])) @@ -115,7 +115,7 @@ class CensusColumnConditionCanadaTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('M'); @@ -137,7 +137,7 @@ class CensusColumnConditionCanadaTest extends TestCase $spouse->method('getDeathDate')->willReturn(new Date('1820')); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -146,7 +146,7 @@ class CensusColumnConditionCanadaTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('F'); @@ -241,7 +241,7 @@ class CensusColumnConditionCanadaTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -268,7 +268,7 @@ class CensusColumnConditionCanadaTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -295,7 +295,7 @@ class CensusColumnConditionCanadaTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -322,7 +322,7 @@ class CensusColumnConditionCanadaTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') diff --git a/tests/app/Census/CensusColumnConditionCanadaWidowedFemaleTest.php b/tests/app/Census/CensusColumnConditionCanadaWidowedFemaleTest.php index d677025ee6..691a8ef7e4 100644 --- a/tests/app/Census/CensusColumnConditionCanadaWidowedFemaleTest.php +++ b/tests/app/Census/CensusColumnConditionCanadaWidowedFemaleTest.php @@ -107,7 +107,7 @@ class CensusColumnConditionCanadaWidowedFemaleTest extends TestCase $spouse->method('getDeathDate')->willReturn(new Date('1820')); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family->expects(self::exactly(2)) ->method('facts') ->with(self::withConsecutive([['MARR'], ['DIV']])) @@ -115,7 +115,7 @@ class CensusColumnConditionCanadaWidowedFemaleTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('M'); @@ -137,7 +137,7 @@ class CensusColumnConditionCanadaWidowedFemaleTest extends TestCase $spouse->method('getDeathDate')->willReturn(new Date('1820')); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -146,7 +146,7 @@ class CensusColumnConditionCanadaWidowedFemaleTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('F'); @@ -241,7 +241,7 @@ class CensusColumnConditionCanadaWidowedFemaleTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -268,7 +268,7 @@ class CensusColumnConditionCanadaWidowedFemaleTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -295,7 +295,7 @@ class CensusColumnConditionCanadaWidowedFemaleTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -322,7 +322,7 @@ class CensusColumnConditionCanadaWidowedFemaleTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') diff --git a/tests/app/Census/CensusColumnConditionCanadaWidowedMaleTest.php b/tests/app/Census/CensusColumnConditionCanadaWidowedMaleTest.php index 6653b0726d..8a0b330447 100644 --- a/tests/app/Census/CensusColumnConditionCanadaWidowedMaleTest.php +++ b/tests/app/Census/CensusColumnConditionCanadaWidowedMaleTest.php @@ -107,7 +107,7 @@ class CensusColumnConditionCanadaWidowedMaleTest extends TestCase $spouse->method('getDeathDate')->willReturn(new Date('1820')); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family->expects(self::exactly(2)) ->method('facts') ->with(self::withConsecutive([['MARR'], ['DIV']])) @@ -115,7 +115,7 @@ class CensusColumnConditionCanadaWidowedMaleTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('M'); @@ -137,7 +137,7 @@ class CensusColumnConditionCanadaWidowedMaleTest extends TestCase $spouse->method('getDeathDate')->willReturn(new Date('1820')); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -146,7 +146,7 @@ class CensusColumnConditionCanadaWidowedMaleTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('F'); @@ -241,7 +241,7 @@ class CensusColumnConditionCanadaWidowedMaleTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -268,7 +268,7 @@ class CensusColumnConditionCanadaWidowedMaleTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -295,7 +295,7 @@ class CensusColumnConditionCanadaWidowedMaleTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -322,7 +322,7 @@ class CensusColumnConditionCanadaWidowedMaleTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') diff --git a/tests/app/Census/CensusColumnConditionCanadaWidowedTest.php b/tests/app/Census/CensusColumnConditionCanadaWidowedTest.php index d762c51174..08e0c5fdd2 100644 --- a/tests/app/Census/CensusColumnConditionCanadaWidowedTest.php +++ b/tests/app/Census/CensusColumnConditionCanadaWidowedTest.php @@ -107,7 +107,7 @@ class CensusColumnConditionCanadaWidowedTest extends TestCase $spouse->method('getDeathDate')->willReturn(new Date('1820')); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family->expects(self::exactly(2)) ->method('facts') ->with(self::withConsecutive([['MARR'], ['DIV']])) @@ -115,7 +115,7 @@ class CensusColumnConditionCanadaWidowedTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('M'); @@ -137,7 +137,7 @@ class CensusColumnConditionCanadaWidowedTest extends TestCase $spouse->method('getDeathDate')->willReturn(new Date('1820')); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -146,7 +146,7 @@ class CensusColumnConditionCanadaWidowedTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('F'); @@ -241,7 +241,7 @@ class CensusColumnConditionCanadaWidowedTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -268,7 +268,7 @@ class CensusColumnConditionCanadaWidowedTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -295,7 +295,7 @@ class CensusColumnConditionCanadaWidowedTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -322,7 +322,7 @@ class CensusColumnConditionCanadaWidowedTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') diff --git a/tests/app/Census/CensusColumnConditionDanishTest.php b/tests/app/Census/CensusColumnConditionDanishTest.php index 4473486056..c21077e4cd 100644 --- a/tests/app/Census/CensusColumnConditionDanishTest.php +++ b/tests/app/Census/CensusColumnConditionDanishTest.php @@ -115,7 +115,7 @@ class CensusColumnConditionDanishTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('M'); @@ -145,7 +145,7 @@ class CensusColumnConditionDanishTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('F'); diff --git a/tests/app/Census/CensusColumnConditionEnglishTest.php b/tests/app/Census/CensusColumnConditionEnglishTest.php index 1eec84135d..c73516ba8a 100644 --- a/tests/app/Census/CensusColumnConditionEnglishTest.php +++ b/tests/app/Census/CensusColumnConditionEnglishTest.php @@ -115,7 +115,7 @@ class CensusColumnConditionEnglishTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('M'); @@ -145,7 +145,7 @@ class CensusColumnConditionEnglishTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('F'); diff --git a/tests/app/Census/CensusColumnConditionFrenchFemmeTest.php b/tests/app/Census/CensusColumnConditionFrenchFemmeTest.php index 95809b546e..66742dc911 100644 --- a/tests/app/Census/CensusColumnConditionFrenchFemmeTest.php +++ b/tests/app/Census/CensusColumnConditionFrenchFemmeTest.php @@ -115,7 +115,7 @@ class CensusColumnConditionFrenchFemmeTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('M'); @@ -145,7 +145,7 @@ class CensusColumnConditionFrenchFemmeTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('F'); diff --git a/tests/app/Census/CensusColumnConditionFrenchFilleTest.php b/tests/app/Census/CensusColumnConditionFrenchFilleTest.php index c7a2b1c025..f8ac0cee75 100644 --- a/tests/app/Census/CensusColumnConditionFrenchFilleTest.php +++ b/tests/app/Census/CensusColumnConditionFrenchFilleTest.php @@ -115,7 +115,7 @@ class CensusColumnConditionFrenchFilleTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('M'); @@ -145,7 +145,7 @@ class CensusColumnConditionFrenchFilleTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('F'); diff --git a/tests/app/Census/CensusColumnConditionFrenchGarconTest.php b/tests/app/Census/CensusColumnConditionFrenchGarconTest.php index 2509ec3fc1..80d40e8b5d 100644 --- a/tests/app/Census/CensusColumnConditionFrenchGarconTest.php +++ b/tests/app/Census/CensusColumnConditionFrenchGarconTest.php @@ -115,7 +115,7 @@ class CensusColumnConditionFrenchGarconTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('M'); @@ -145,7 +145,7 @@ class CensusColumnConditionFrenchGarconTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('F'); diff --git a/tests/app/Census/CensusColumnConditionFrenchHommeTest.php b/tests/app/Census/CensusColumnConditionFrenchHommeTest.php index 3b625b90d3..4e31bd3f49 100644 --- a/tests/app/Census/CensusColumnConditionFrenchHommeTest.php +++ b/tests/app/Census/CensusColumnConditionFrenchHommeTest.php @@ -115,7 +115,7 @@ class CensusColumnConditionFrenchHommeTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('M'); @@ -145,7 +145,7 @@ class CensusColumnConditionFrenchHommeTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('F'); diff --git a/tests/app/Census/CensusColumnConditionFrenchVeufTest.php b/tests/app/Census/CensusColumnConditionFrenchVeufTest.php index 7cc3f8aa5d..c017102409 100644 --- a/tests/app/Census/CensusColumnConditionFrenchVeufTest.php +++ b/tests/app/Census/CensusColumnConditionFrenchVeufTest.php @@ -115,7 +115,7 @@ class CensusColumnConditionFrenchVeufTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('M'); @@ -145,7 +145,7 @@ class CensusColumnConditionFrenchVeufTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('F'); diff --git a/tests/app/Census/CensusColumnConditionFrenchVeuveTest.php b/tests/app/Census/CensusColumnConditionFrenchVeuveTest.php index 414fb1788a..6c061acdd0 100644 --- a/tests/app/Census/CensusColumnConditionFrenchVeuveTest.php +++ b/tests/app/Census/CensusColumnConditionFrenchVeuveTest.php @@ -107,7 +107,7 @@ class CensusColumnConditionFrenchVeuveTest extends TestCase $spouse->method('getDeathDate')->willReturn(new Date('1820')); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -116,7 +116,7 @@ class CensusColumnConditionFrenchVeuveTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('M'); @@ -138,7 +138,7 @@ class CensusColumnConditionFrenchVeuveTest extends TestCase $spouse->method('getDeathDate')->willReturn(new Date('1820')); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -147,7 +147,7 @@ class CensusColumnConditionFrenchVeuveTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('F'); @@ -242,7 +242,7 @@ class CensusColumnConditionFrenchVeuveTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -269,7 +269,7 @@ class CensusColumnConditionFrenchVeuveTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') diff --git a/tests/app/Census/CensusColumnConditionUsTest.php b/tests/app/Census/CensusColumnConditionUsTest.php index 8ae13447f9..fa4dc25285 100644 --- a/tests/app/Census/CensusColumnConditionUsTest.php +++ b/tests/app/Census/CensusColumnConditionUsTest.php @@ -107,7 +107,7 @@ class CensusColumnConditionUsTest extends TestCase $spouse->method('getDeathDate')->willReturn(new Date('1820')); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family->expects(self::exactly(2)) ->method('facts') ->with(self::withConsecutive([['MARR'], ['DIV']])) @@ -115,7 +115,7 @@ class CensusColumnConditionUsTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('M'); @@ -137,7 +137,7 @@ class CensusColumnConditionUsTest extends TestCase $spouse->method('getDeathDate')->willReturn(new Date('1820')); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -146,7 +146,7 @@ class CensusColumnConditionUsTest extends TestCase new Collection([$fact]), new Collection() ); - $family->expects(self::once())->method('spouse')->willReturn($spouse); + $family->expects($this->once())->method('spouse')->willReturn($spouse); $individual = $this->createMock(Individual::class); $individual->method('sex')->willReturn('F'); @@ -241,7 +241,7 @@ class CensusColumnConditionUsTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -268,7 +268,7 @@ class CensusColumnConditionUsTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -295,7 +295,7 @@ class CensusColumnConditionUsTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') @@ -322,7 +322,7 @@ class CensusColumnConditionUsTest extends TestCase $fact = $this->createMock(Fact::class); $family = $this->createMock(Family::class); - $family->expects(self::once())->method('getMarriageDate')->willReturn(new Date('')); + $family->expects($this->once())->method('getMarriageDate')->willReturn(new Date('')); $family ->expects(self::exactly(2)) ->method('facts') diff --git a/tests/app/Elements/XrefFamilyTest.php b/tests/app/Elements/XrefFamilyTest.php index 172d3bd202..80486adf18 100644 --- a/tests/app/Elements/XrefFamilyTest.php +++ b/tests/app/Elements/XrefFamilyTest.php @@ -41,7 +41,7 @@ class XrefFamilyTest extends TestCase $factory = $this->createMock(FamilyFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn(null); @@ -75,11 +75,11 @@ class XrefFamilyTest extends TestCase $record = $this->createMock(Family::class); - $record->expects(self::once()) + $record->expects($this->once()) ->method('fullName') ->willReturn('Full Name'); - $record->expects(self::once()) + $record->expects($this->once()) ->method('url') ->willReturn('https://url'); @@ -87,7 +87,7 @@ class XrefFamilyTest extends TestCase $factory = $this->createMock(FamilyFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn($record); @@ -113,7 +113,7 @@ class XrefFamilyTest extends TestCase $factory = $this->createMock(FamilyFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn(null); diff --git a/tests/app/Elements/XrefIndividualTest.php b/tests/app/Elements/XrefIndividualTest.php index 2d55ea8243..96e2f26eba 100644 --- a/tests/app/Elements/XrefIndividualTest.php +++ b/tests/app/Elements/XrefIndividualTest.php @@ -41,7 +41,7 @@ class XrefIndividualTest extends TestCase $factory = $this->createMock(IndividualFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn(null); @@ -75,11 +75,11 @@ class XrefIndividualTest extends TestCase $record = $this->createMock(Individual::class); - $record->expects(self::once()) + $record->expects($this->once()) ->method('fullName') ->willReturn('Full Name'); - $record->expects(self::once()) + $record->expects($this->once()) ->method('url') ->willReturn('https://url'); @@ -87,7 +87,7 @@ class XrefIndividualTest extends TestCase $factory = $this->createMock(IndividualFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn($record); @@ -113,7 +113,7 @@ class XrefIndividualTest extends TestCase $factory = $this->createMock(IndividualFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn(null); diff --git a/tests/app/Elements/XrefLocationTest.php b/tests/app/Elements/XrefLocationTest.php index ba4df12b5f..2d351a774b 100644 --- a/tests/app/Elements/XrefLocationTest.php +++ b/tests/app/Elements/XrefLocationTest.php @@ -41,7 +41,7 @@ class XrefLocationTest extends TestCase $factory = $this->createMock(LocationFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn(null); @@ -75,11 +75,11 @@ class XrefLocationTest extends TestCase $record = $this->createMock(Location::class); - $record->expects(self::once()) + $record->expects($this->once()) ->method('fullName') ->willReturn('Full Name'); - $record->expects(self::once()) + $record->expects($this->once()) ->method('url') ->willReturn('https://url'); @@ -87,7 +87,7 @@ class XrefLocationTest extends TestCase $factory = $this->createMock(LocationFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn($record); @@ -113,7 +113,7 @@ class XrefLocationTest extends TestCase $factory = $this->createMock(LocationFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn(null); diff --git a/tests/app/Elements/XrefMediaTest.php b/tests/app/Elements/XrefMediaTest.php index 49c0eb9f60..0c424d34db 100644 --- a/tests/app/Elements/XrefMediaTest.php +++ b/tests/app/Elements/XrefMediaTest.php @@ -41,7 +41,7 @@ class XrefMediaTest extends TestCase $factory = $this->createMock(MediaFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn(null); @@ -74,11 +74,11 @@ class XrefMediaTest extends TestCase $record = $this->createMock(Media::class); - $record->expects(self::once()) + $record->expects($this->once()) ->method('fullName') ->willReturn('Full Name'); - $record->expects(self::once()) + $record->expects($this->once()) ->method('url') ->willReturn('https://url'); @@ -86,7 +86,7 @@ class XrefMediaTest extends TestCase $factory = $this->createMock(MediaFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn($record); @@ -112,7 +112,7 @@ class XrefMediaTest extends TestCase $factory = $this->createMock(MediaFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn(null); diff --git a/tests/app/Elements/XrefNoteTest.php b/tests/app/Elements/XrefNoteTest.php index 13b1407255..15d0aadb95 100644 --- a/tests/app/Elements/XrefNoteTest.php +++ b/tests/app/Elements/XrefNoteTest.php @@ -40,7 +40,7 @@ class XrefNoteTest extends TestCase $factory = $this->createMock(NoteFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn(null); @@ -69,11 +69,11 @@ class XrefNoteTest extends TestCase $record = $this->createMock(Note::class); - $record->expects(self::once()) + $record->expects($this->once()) ->method('fullName') ->willReturn('Full Name'); - $record->expects(self::once()) + $record->expects($this->once()) ->method('url') ->willReturn('https://url'); @@ -81,7 +81,7 @@ class XrefNoteTest extends TestCase $factory = $this->createMock(NoteFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn($record); @@ -107,7 +107,7 @@ class XrefNoteTest extends TestCase $factory = $this->createMock(NoteFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn(null); diff --git a/tests/app/Elements/XrefRepositoryTest.php b/tests/app/Elements/XrefRepositoryTest.php index e4c5ce4ccb..36469aaea3 100644 --- a/tests/app/Elements/XrefRepositoryTest.php +++ b/tests/app/Elements/XrefRepositoryTest.php @@ -41,7 +41,7 @@ class XrefRepositoryTest extends TestCase $factory = $this->createMock(RepositoryFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn(null); @@ -74,11 +74,11 @@ class XrefRepositoryTest extends TestCase $record = $this->createMock(Repository::class); - $record->expects(self::once()) + $record->expects($this->once()) ->method('fullName') ->willReturn('Full Name'); - $record->expects(self::once()) + $record->expects($this->once()) ->method('url') ->willReturn('https://url'); @@ -86,7 +86,7 @@ class XrefRepositoryTest extends TestCase $factory = $this->createMock(RepositoryFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn($record); @@ -112,7 +112,7 @@ class XrefRepositoryTest extends TestCase $factory = $this->createMock(RepositoryFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn(null); diff --git a/tests/app/Elements/XrefSharedNoteTest.php b/tests/app/Elements/XrefSharedNoteTest.php index 336822293a..ab83ed16e0 100644 --- a/tests/app/Elements/XrefSharedNoteTest.php +++ b/tests/app/Elements/XrefSharedNoteTest.php @@ -40,7 +40,7 @@ class XrefSharedNoteTest extends TestCase $factory = $this->createMock(SharedNoteFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn(null); @@ -69,11 +69,11 @@ class XrefSharedNoteTest extends TestCase $record = $this->createMock(SharedNote::class); - $record->expects(self::once()) + $record->expects($this->once()) ->method('fullName') ->willReturn('Full Name'); - $record->expects(self::once()) + $record->expects($this->once()) ->method('url') ->willReturn('https://url'); @@ -81,7 +81,7 @@ class XrefSharedNoteTest extends TestCase $factory = $this->createMock(SharedNoteFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn($record); @@ -107,7 +107,7 @@ class XrefSharedNoteTest extends TestCase $factory = $this->createMock(SharedNoteFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn(null); diff --git a/tests/app/Elements/XrefSourceTest.php b/tests/app/Elements/XrefSourceTest.php index 8bb4b04144..794a9b4c7a 100644 --- a/tests/app/Elements/XrefSourceTest.php +++ b/tests/app/Elements/XrefSourceTest.php @@ -43,7 +43,7 @@ class XrefSourceTest extends TestCase $factory = $this->createMock(SourceFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn(null); @@ -95,11 +95,11 @@ class XrefSourceTest extends TestCase $record = $this->createMock(Source::class); - $record->expects(self::once()) + $record->expects($this->once()) ->method('fullName') ->willReturn('Full Name'); - $record->expects(self::once()) + $record->expects($this->once()) ->method('url') ->willReturn('https://url'); @@ -107,7 +107,7 @@ class XrefSourceTest extends TestCase $factory = $this->createMock(SourceFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn($record); @@ -142,7 +142,7 @@ class XrefSourceTest extends TestCase $factory = $this->createMock(SourceFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn(null); diff --git a/tests/app/Elements/XrefSubmissionTest.php b/tests/app/Elements/XrefSubmissionTest.php index e642c4c800..d81b3199dd 100644 --- a/tests/app/Elements/XrefSubmissionTest.php +++ b/tests/app/Elements/XrefSubmissionTest.php @@ -41,7 +41,7 @@ class XrefSubmissionTest extends TestCase $factory = $this->createMock(SubmissionFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn(null); @@ -74,11 +74,11 @@ class XrefSubmissionTest extends TestCase $record = $this->createMock(Submission::class); - $record->expects(self::once()) + $record->expects($this->once()) ->method('fullName') ->willReturn('Full Name'); - $record->expects(self::once()) + $record->expects($this->once()) ->method('url') ->willReturn('https://url'); @@ -86,7 +86,7 @@ class XrefSubmissionTest extends TestCase $factory = $this->createMock(SubmissionFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn($record); @@ -112,7 +112,7 @@ class XrefSubmissionTest extends TestCase $factory = $this->createMock(SubmissionFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn(null); diff --git a/tests/app/Elements/XrefSubmitterTest.php b/tests/app/Elements/XrefSubmitterTest.php index 7ac2cdb776..097740652b 100644 --- a/tests/app/Elements/XrefSubmitterTest.php +++ b/tests/app/Elements/XrefSubmitterTest.php @@ -41,7 +41,7 @@ class XrefSubmitterTest extends TestCase $factory = $this->createMock(SubmitterFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn(null); @@ -74,11 +74,11 @@ class XrefSubmitterTest extends TestCase $record = $this->createMock(Submitter::class); - $record->expects(self::once()) + $record->expects($this->once()) ->method('fullName') ->willReturn('Full Name'); - $record->expects(self::once()) + $record->expects($this->once()) ->method('url') ->willReturn('https://url'); @@ -86,7 +86,7 @@ class XrefSubmitterTest extends TestCase $factory = $this->createMock(SubmitterFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn($record); @@ -112,7 +112,7 @@ class XrefSubmitterTest extends TestCase $factory = $this->createMock(SubmitterFactory::class); - $factory->expects(self::once()) + $factory->expects($this->once()) ->method('make') ->willReturn(null); diff --git a/tests/app/Http/Middleware/BootModulesTest.php b/tests/app/Http/Middleware/BootModulesTest.php index 290927be61..89b4d55b87 100644 --- a/tests/app/Http/Middleware/BootModulesTest.php +++ b/tests/app/Http/Middleware/BootModulesTest.php @@ -40,7 +40,7 @@ class BootModulesTest extends TestCase $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) + ->expects($this->once()) ->method('bootModules') ->with($theme); diff --git a/tests/app/Http/RequestHandlers/AccountUpdateTest.php b/tests/app/Http/RequestHandlers/AccountUpdateTest.php index 785f6e9d6f..dc5d65b21c 100644 --- a/tests/app/Http/RequestHandlers/AccountUpdateTest.php +++ b/tests/app/Http/RequestHandlers/AccountUpdateTest.php @@ -35,10 +35,10 @@ class AccountUpdateTest extends TestCase $user_service = $this->createMock(UserService::class); $user = $this->createMock(User::class); - $user->expects(self::once())->method('setEmail')->with('b'); - $user->expects(self::once())->method('setPassword')->with('e'); - $user->expects(self::once())->method('setRealName')->with('d'); - $user->expects(self::once())->method('setUserName')->with('h'); + $user->expects($this->once())->method('setEmail')->with('b'); + $user->expects($this->once())->method('setPassword')->with('e'); + $user->expects($this->once())->method('setRealName')->with('d'); + $user->expects($this->once())->method('setUserName')->with('h'); $user->expects(self::exactly(4)) ->method('setPreference') ->with( @@ -47,7 +47,7 @@ class AccountUpdateTest extends TestCase ); $tree = $this->createMock(Tree::class); - $tree->expects(self::once())->method('setUserPreference')->with($user, UserInterface::PREF_TREE_DEFAULT_XREF, 'f'); + $tree->expects($this->once())->method('setUserPreference')->with($user, UserInterface::PREF_TREE_DEFAULT_XREF, 'f'); $handler = new AccountUpdate($user_service); $request = self::createRequest() diff --git a/tests/app/Http/RequestHandlers/DeleteUserTest.php b/tests/app/Http/RequestHandlers/DeleteUserTest.php index da79a6798b..a1f9d1ce95 100644 --- a/tests/app/Http/RequestHandlers/DeleteUserTest.php +++ b/tests/app/Http/RequestHandlers/DeleteUserTest.php @@ -39,7 +39,7 @@ class DeleteUserTest extends TestCase $user->method('id')->willReturn(1); $user_service = $this->createMock(UserService::class); - $user_service->expects(self::once())->method('find')->willReturn($user); + $user_service->expects($this->once())->method('find')->willReturn($user); $request = self::createRequest() ->withAttribute('user_id', $user->id()); @@ -55,7 +55,7 @@ class DeleteUserTest extends TestCase $this->expectExceptionMessage('User ID 98765 not found'); $user_service = $this->createMock(UserService::class); - $user_service->expects(self::once())->method('find')->willReturn(null); + $user_service->expects($this->once())->method('find')->willReturn(null); $request = self::createRequest() ->withAttribute('user_id', 98765); @@ -70,10 +70,10 @@ class DeleteUserTest extends TestCase $user = $this->createMock(User::class); $user->method('id')->willReturn(1); - $user->expects(self::once())->method('getPreference')->with(UserInterface::PREF_IS_ADMINISTRATOR)->willReturn('1'); + $user->expects($this->once())->method('getPreference')->with(UserInterface::PREF_IS_ADMINISTRATOR)->willReturn('1'); $user_service = $this->createMock(UserService::class); - $user_service->expects(self::once())->method('find')->willReturn($user); + $user_service->expects($this->once())->method('find')->willReturn($user); $request = self::createRequest() ->withAttribute('user_id', $user->id()); diff --git a/tests/app/Http/RequestHandlers/MasqueradeTest.php b/tests/app/Http/RequestHandlers/MasqueradeTest.php index 30b5ea0fc9..5ee0ac8960 100644 --- a/tests/app/Http/RequestHandlers/MasqueradeTest.php +++ b/tests/app/Http/RequestHandlers/MasqueradeTest.php @@ -42,7 +42,7 @@ class MasqueradeTest extends TestCase $user2->method('id')->willReturn(2); $user_service = $this->createMock(UserService::class); - $user_service->expects(self::once())->method('find')->willReturn($user2); + $user_service->expects($this->once())->method('find')->willReturn($user2); $request = self::createRequest() ->withAttribute('user', $user1) @@ -62,7 +62,7 @@ class MasqueradeTest extends TestCase $user->method('id')->willReturn(1); $user_service = $this->createMock(UserService::class); - $user_service->expects(self::once())->method('find')->willReturn($user); + $user_service->expects($this->once())->method('find')->willReturn($user); $request = self::createRequest() ->withAttribute('user', $user) @@ -84,7 +84,7 @@ class MasqueradeTest extends TestCase $user->method('id')->willReturn(1); $user_service = $this->createMock(UserService::class); - $user_service->expects(self::once())->method('find')->willReturn(null); + $user_service->expects($this->once())->method('find')->willReturn(null); $request = self::createRequest() ->withAttribute('user', $user) diff --git a/tests/app/Http/RequestHandlers/ModuleActionTest.php b/tests/app/Http/RequestHandlers/ModuleActionTest.php index 9477f96211..9b4502373f 100644 --- a/tests/app/Http/RequestHandlers/ModuleActionTest.php +++ b/tests/app/Http/RequestHandlers/ModuleActionTest.php @@ -39,7 +39,7 @@ class ModuleActionTest extends TestCase { $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) + ->expects($this->once()) ->method('findByName') ->with('test') ->willReturn($this->fooModule()); @@ -63,7 +63,7 @@ class ModuleActionTest extends TestCase $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) + ->expects($this->once()) ->method('findByName') ->with('test') ->willReturn($this->fooModule()); @@ -84,7 +84,7 @@ class ModuleActionTest extends TestCase $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) + ->expects($this->once()) ->method('findByName') ->with('test') ->willReturn(null); @@ -105,7 +105,7 @@ class ModuleActionTest extends TestCase $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) + ->expects($this->once()) ->method('findByName') ->with('test') ->willReturn($this->fooModule()); diff --git a/tests/app/Http/RequestHandlers/PasswordResetPageTest.php b/tests/app/Http/RequestHandlers/PasswordResetPageTest.php index 0519a5a00b..73898b5997 100644 --- a/tests/app/Http/RequestHandlers/PasswordResetPageTest.php +++ b/tests/app/Http/RequestHandlers/PasswordResetPageTest.php @@ -37,7 +37,7 @@ class PasswordResetPageTest extends TestCase $user_service = $this->createMock(UserService::class); $user_service - ->expects(self::once()) + ->expects($this->once()) ->method('findByToken') ->with('1234') ->willReturn($user); @@ -54,7 +54,7 @@ class PasswordResetPageTest extends TestCase { $user_service = $this->createMock(UserService::class); $user_service - ->expects(self::once()) + ->expects($this->once()) ->method('findByToken') ->with('4321') ->willReturn(null); diff --git a/tests/app/Http/RequestHandlers/PingTest.php b/tests/app/Http/RequestHandlers/PingTest.php index 57c5317d4a..9f68ffb2df 100644 --- a/tests/app/Http/RequestHandlers/PingTest.php +++ b/tests/app/Http/RequestHandlers/PingTest.php @@ -31,8 +31,8 @@ class PingTest extends TestCase public function testPingOK(): void { $server_check_service = $this->createMock(ServerCheckService::class); - $server_check_service->expects(self::once())->method('serverErrors')->willReturn(new Collection()); - $server_check_service->expects(self::once())->method('serverWarnings')->willReturn(new Collection()); + $server_check_service->expects($this->once())->method('serverErrors')->willReturn(new Collection()); + $server_check_service->expects($this->once())->method('serverWarnings')->willReturn(new Collection()); $request = self::createRequest(); $handler = new Ping($server_check_service); @@ -45,8 +45,8 @@ class PingTest extends TestCase public function testPingWarnings(): void { $server_check_service = $this->createMock(ServerCheckService::class); - $server_check_service->expects(self::once())->method('serverErrors')->willReturn(new Collection()); - $server_check_service->expects(self::once())->method('serverWarnings')->willReturn(new Collection('warning')); + $server_check_service->expects($this->once())->method('serverErrors')->willReturn(new Collection()); + $server_check_service->expects($this->once())->method('serverWarnings')->willReturn(new Collection('warning')); $request = self::createRequest(); $handler = new Ping($server_check_service); @@ -59,7 +59,7 @@ class PingTest extends TestCase public function testPingErrors(): void { $server_check_service = $this->createMock(ServerCheckService::class); - $server_check_service->expects(self::once())->method('serverErrors')->willReturn(new Collection('error')); + $server_check_service->expects($this->once())->method('serverErrors')->willReturn(new Collection('error')); $request = self::createRequest(); $handler = new Ping($server_check_service); diff --git a/tests/app/Http/RequestHandlers/RedirectAncestryPhpTest.php b/tests/app/Http/RequestHandlers/RedirectAncestryPhpTest.php index 084f0f9340..1f4a531a6b 100644 --- a/tests/app/Http/RequestHandlers/RedirectAncestryPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectAncestryPhpTest.php @@ -25,6 +25,7 @@ use Fisharebest\Webtrees\Factories\IndividualFactory; use Fisharebest\Webtrees\Http\Exceptions\HttpGoneException; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\Module\AncestorsChartModule; +use Fisharebest\Webtrees\Module\ModuleChartInterface; use Fisharebest\Webtrees\Registry; use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\TreeService; @@ -47,7 +48,7 @@ class RedirectAncestryPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -55,7 +56,7 @@ class RedirectAncestryPhpTest extends TestCase $individual_factory = $this->createMock(IndividualFactory::class); $individual_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn($individual); @@ -64,23 +65,20 @@ class RedirectAncestryPhpTest extends TestCase $module = $this->createMock(AncestorsChartModule::class); $module - ->expects(self::once()) + ->expects($this->once()) ->method('chartUrl') ->willReturn('https://www.example.com'); $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(AncestorsChartModule::class) + ->expects($this->once()) + ->method('findByComponent') + ->with(ModuleChartInterface::class) ->willReturn(new Collection([$module])); $handler = new RedirectAncestryPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $response = $handler->handle($request); @@ -90,26 +88,26 @@ class RedirectAncestryPhpTest extends TestCase public function testModuleDisabled(): void { - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once())->method('findByInterface') - ->with(AncestorsChartModule::class) - ->willReturn(new Collection()); - $tree = $this->createMock(Tree::class); + $tree + ->method('name') + ->willReturn('tree1'); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); + + $module_service = $this->createMock(ModuleService::class); + $module_service + ->expects($this->once())->method('findByComponent') + ->with(ModuleChartInterface::class) + ->willReturn(new Collection()); $handler = new RedirectAncestryPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $this->expectException(HttpGoneException::class); @@ -118,27 +116,17 @@ class RedirectAncestryPhpTest extends TestCase public function testNoSuchTree(): void { - $module = $this->createMock(AncestorsChartModule::class); - - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(AncestorsChartModule::class) - ->willReturn(new Collection([$module])); - $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); + $module_service = $this->createMock(ModuleService::class); + $handler = new RedirectAncestryPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $this->expectException(HttpGoneException::class); diff --git a/tests/app/Http/RequestHandlers/RedirectBranchesPhpTest.php b/tests/app/Http/RequestHandlers/RedirectBranchesPhpTest.php index 521041ea7c..de084eaa6e 100644 --- a/tests/app/Http/RequestHandlers/RedirectBranchesPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectBranchesPhpTest.php @@ -23,6 +23,7 @@ use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; use Fisharebest\Webtrees\Http\Exceptions\HttpGoneException; use Fisharebest\Webtrees\Module\BranchesListModule; +use Fisharebest\Webtrees\Module\ModuleListInterface; use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\TreeService; use Fisharebest\Webtrees\TestCase; @@ -44,7 +45,7 @@ class RedirectBranchesPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -52,9 +53,9 @@ class RedirectBranchesPhpTest extends TestCase $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(BranchesListModule::class) + ->expects($this->once()) + ->method('findByComponent') + ->with(ModuleListInterface::class) ->willReturn(new Collection([$module])); $handler = new RedirectBranchesPhp($module_service, $tree_service); @@ -78,19 +79,19 @@ class RedirectBranchesPhpTest extends TestCase public function testModuleDisabled(): void { - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once())->method('findByInterface') - ->with(BranchesListModule::class) - ->willReturn(new Collection()); - $tree = $this->createMock(Tree::class); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); + + $module_service = $this->createMock(ModuleService::class); + $module_service + ->method('findByComponent') + ->with(ModuleListInterface::class) + ->willReturn(new Collection()); $handler = new RedirectBranchesPhp($module_service, $tree_service); @@ -106,21 +107,14 @@ class RedirectBranchesPhpTest extends TestCase public function testNoSuchTree(): void { - $module = $this->createMock(BranchesListModule::class); - - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(BranchesListModule::class) - ->willReturn(new Collection([$module])); - $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); + $module_service = $this->createMock(ModuleService::class); + $handler = new RedirectBranchesPhp($module_service, $tree_service); $request = self::createRequest( diff --git a/tests/app/Http/RequestHandlers/RedirectCalendarPhpTest.php b/tests/app/Http/RequestHandlers/RedirectCalendarPhpTest.php index 0d54371d33..9995b9c8d0 100644 --- a/tests/app/Http/RequestHandlers/RedirectCalendarPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectCalendarPhpTest.php @@ -42,7 +42,7 @@ class RedirectCalendarPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -69,7 +69,7 @@ class RedirectCalendarPhpTest extends TestCase { $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); diff --git a/tests/app/Http/RequestHandlers/RedirectCompactPhpTest.php b/tests/app/Http/RequestHandlers/RedirectCompactPhpTest.php index 5988355585..2ad875c10e 100644 --- a/tests/app/Http/RequestHandlers/RedirectCompactPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectCompactPhpTest.php @@ -25,6 +25,8 @@ use Fisharebest\Webtrees\Factories\IndividualFactory; use Fisharebest\Webtrees\Http\Exceptions\HttpGoneException; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\Module\CompactTreeChartModule; +use Fisharebest\Webtrees\Module\ModuleChartInterface; +use Fisharebest\Webtrees\Module\ModuleListInterface; use Fisharebest\Webtrees\Registry; use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\TreeService; @@ -47,7 +49,7 @@ class RedirectCompactPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -55,7 +57,7 @@ class RedirectCompactPhpTest extends TestCase $individual_factory = $this->createMock(IndividualFactory::class); $individual_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn($individual); @@ -64,23 +66,20 @@ class RedirectCompactPhpTest extends TestCase $module = $this->createMock(CompactTreeChartModule::class); $module - ->expects(self::once()) + ->expects($this->once()) ->method('chartUrl') ->willReturn('https://www.example.com'); $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(CompactTreeChartModule::class) + ->expects($this->once()) + ->method('findByComponent') + ->with(ModuleChartInterface::class) ->willReturn(new Collection([$module])); $handler = new RedirectCompactPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $response = $handler->handle($request); @@ -92,24 +91,21 @@ class RedirectCompactPhpTest extends TestCase { $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once())->method('findByInterface') - ->with(CompactTreeChartModule::class) + ->expects($this->once())->method('findByComponent') + ->with(ModuleChartInterface::class) ->willReturn(new Collection()); $tree = $this->createMock(Tree::class); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); $handler = new RedirectCompactPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $this->expectException(HttpGoneException::class); @@ -118,27 +114,17 @@ class RedirectCompactPhpTest extends TestCase public function testNoSuchTree(): void { - $module = $this->createMock(CompactTreeChartModule::class); - - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(CompactTreeChartModule::class) - ->willReturn(new Collection([$module])); - $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); + $module_service = $this->createMock(ModuleService::class); + $handler = new RedirectCompactPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $this->expectException(HttpGoneException::class); diff --git a/tests/app/Http/RequestHandlers/RedirectDescendancyPhpTest.php b/tests/app/Http/RequestHandlers/RedirectDescendancyPhpTest.php index ef4a652794..da10c84f5a 100644 --- a/tests/app/Http/RequestHandlers/RedirectDescendancyPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectDescendancyPhpTest.php @@ -25,6 +25,8 @@ use Fisharebest\Webtrees\Factories\IndividualFactory; use Fisharebest\Webtrees\Http\Exceptions\HttpGoneException; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\Module\DescendancyChartModule; +use Fisharebest\Webtrees\Module\ModuleChartInterface; +use Fisharebest\Webtrees\Module\ModuleListInterface; use Fisharebest\Webtrees\Registry; use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\TreeService; @@ -47,7 +49,7 @@ class RedirectDescendancyPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -55,7 +57,7 @@ class RedirectDescendancyPhpTest extends TestCase $individual_factory = $this->createMock(IndividualFactory::class); $individual_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn($individual); @@ -64,15 +66,15 @@ class RedirectDescendancyPhpTest extends TestCase $descendancy_chart = $this->createMock(DescendancyChartModule::class); $descendancy_chart - ->expects(self::once()) + ->expects($this->once()) ->method('chartUrl') ->willReturn('https://www.example.com'); $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(DescendancyChartModule::class) + ->expects($this->once()) + ->method('findByComponent') + ->with(ModuleChartInterface::class) ->willReturn(new Collection([$descendancy_chart])); $handler = new RedirectDescendencyPhp($module_service, $tree_service); @@ -88,24 +90,21 @@ class RedirectDescendancyPhpTest extends TestCase { $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once())->method('findByInterface') - ->with(DescendancyChartModule::class) + ->method('findByComponent') + ->with(ModuleChartInterface::class) ->willReturn(new Collection()); $tree = $this->createMock(Tree::class); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); $handler = new RedirectDescendencyPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $this->expectException(HttpGoneException::class); @@ -114,27 +113,17 @@ class RedirectDescendancyPhpTest extends TestCase public function testNoSuchTree(): void { - $module = $this->createMock(DescendancyChartModule::class); - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(DescendancyChartModule::class) - ->willReturn(new Collection([$module])); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); $handler = new RedirectDescendencyPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $this->expectException(HttpGoneException::class); diff --git a/tests/app/Http/RequestHandlers/RedirectFamListPhpTest.php b/tests/app/Http/RequestHandlers/RedirectFamListPhpTest.php index 7344a5f829..dd13e2080f 100644 --- a/tests/app/Http/RequestHandlers/RedirectFamListPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectFamListPhpTest.php @@ -21,8 +21,10 @@ namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; +use Fisharebest\Webtrees\GuestUser; use Fisharebest\Webtrees\Http\Exceptions\HttpGoneException; use Fisharebest\Webtrees\Module\FamilyListModule; +use Fisharebest\Webtrees\Module\ModuleListInterface; use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\TreeService; use Fisharebest\Webtrees\TestCase; @@ -44,21 +46,21 @@ class RedirectFamListPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); $module = $this->createMock(FamilyListModule::class); $module - ->expects(self::once()) + ->expects($this->once()) ->method('listUrl') ->willReturn('https://www.example.com'); $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(FamilyListModule::class) + ->expects($this->once()) + ->method('findByComponent') + ->with(ModuleListInterface::class, $tree, new GuestUser()) ->willReturn(new Collection([$module])); $handler = new RedirectFamListPhp($module_service, $tree_service); @@ -73,19 +75,22 @@ class RedirectFamListPhpTest extends TestCase public function testModuleDisabled(): void { - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once())->method('findByInterface') - ->with(FamilyListModule::class) - ->willReturn(new Collection()); - $tree = $this->createMock(Tree::class); + $tree + ->method('name') + ->willReturn('tree1'); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); + + $module_service = $this->createMock(ModuleService::class); + $module_service + ->expects($this->once())->method('findByComponent') + ->with(ModuleListInterface::class, $tree, new GuestUser()) + ->willReturn(new Collection()); $handler = new RedirectFamListPhp($module_service, $tree_service); @@ -98,18 +103,11 @@ class RedirectFamListPhpTest extends TestCase public function testNoSuchTree(): void { - $module = $this->createMock(FamilyListModule::class); - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(FamilyListModule::class) - ->willReturn(new Collection([$module])); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); diff --git a/tests/app/Http/RequestHandlers/RedirectFamilyBookPhpTest.php b/tests/app/Http/RequestHandlers/RedirectFamilyBookPhpTest.php index d53df5b3da..0ba77e5f2e 100644 --- a/tests/app/Http/RequestHandlers/RedirectFamilyBookPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectFamilyBookPhpTest.php @@ -25,6 +25,8 @@ use Fisharebest\Webtrees\Factories\IndividualFactory; use Fisharebest\Webtrees\Http\Exceptions\HttpGoneException; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\Module\FamilyBookChartModule; +use Fisharebest\Webtrees\Module\ModuleChartInterface; +use Fisharebest\Webtrees\Module\ModuleListInterface; use Fisharebest\Webtrees\Registry; use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\TreeService; @@ -47,7 +49,7 @@ class RedirectFamilyBookPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -55,7 +57,7 @@ class RedirectFamilyBookPhpTest extends TestCase $individual_factory = $this->createMock(IndividualFactory::class); $individual_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn($individual); @@ -64,15 +66,15 @@ class RedirectFamilyBookPhpTest extends TestCase $Compact_chart = $this->createMock(FamilyBookChartModule::class); $Compact_chart - ->expects(self::once()) + ->expects($this->once()) ->method('chartUrl') ->willReturn('https://www.example.com'); $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(FamilyBookChartModule::class) + ->expects($this->once()) + ->method('findByComponent') + ->with(ModuleChartInterface::class) ->willReturn(new Collection([$Compact_chart])); $handler = new RedirectFamilyBookPhp($module_service, $tree_service); @@ -88,23 +90,21 @@ class RedirectFamilyBookPhpTest extends TestCase { $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once())->method('findByInterface') - ->with(FamilyBookChartModule::class) + ->method('findByComponent') + ->with(ModuleChartInterface::class) ->willReturn(new Collection()); $tree = $this->createMock(Tree::class); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); + $handler = new RedirectFamilyBookPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $this->expectException(HttpGoneException::class); @@ -113,27 +113,17 @@ class RedirectFamilyBookPhpTest extends TestCase public function testNoSuchTree(): void { - $module = $this->createMock(FamilyBookChartModule::class); - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(FamilyBookChartModule::class) - ->willReturn(new Collection([$module])); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); $handler = new RedirectFamilyBookPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $this->expectException(HttpGoneException::class); diff --git a/tests/app/Http/RequestHandlers/RedirectFamilyPhpTest.php b/tests/app/Http/RequestHandlers/RedirectFamilyPhpTest.php index a45ae0c374..e84d51ffd2 100644 --- a/tests/app/Http/RequestHandlers/RedirectFamilyPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectFamilyPhpTest.php @@ -46,7 +46,7 @@ class RedirectFamilyPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -57,7 +57,7 @@ class RedirectFamilyPhpTest extends TestCase $family_factory = $this->createMock(FamilyFactory::class); $family_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn($family); @@ -66,10 +66,7 @@ class RedirectFamilyPhpTest extends TestCase $handler = new RedirectFamilyPhp($tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'famid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'famid' => 'X123']); $response = $handler->handle($request); @@ -83,16 +80,13 @@ class RedirectFamilyPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); $handler = new RedirectFamilyPhp($tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'famid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'famid' => 'X123']); $this->expectException(HttpGoneException::class); diff --git a/tests/app/Http/RequestHandlers/RedirectFanChartPhpTest.php b/tests/app/Http/RequestHandlers/RedirectFanChartPhpTest.php index 6cf2de364f..d9f3984f86 100644 --- a/tests/app/Http/RequestHandlers/RedirectFanChartPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectFanChartPhpTest.php @@ -25,6 +25,7 @@ use Fisharebest\Webtrees\Factories\IndividualFactory; use Fisharebest\Webtrees\Http\Exceptions\HttpGoneException; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\Module\FanChartModule; +use Fisharebest\Webtrees\Module\ModuleChartInterface; use Fisharebest\Webtrees\Registry; use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\TreeService; @@ -47,7 +48,7 @@ class RedirectFanChartPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -55,7 +56,7 @@ class RedirectFanChartPhpTest extends TestCase $individual_factory = $this->createMock(IndividualFactory::class); $individual_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn($individual); @@ -64,23 +65,20 @@ class RedirectFanChartPhpTest extends TestCase $module = $this->createMock(FanChartModule::class); $module - ->expects(self::once()) + ->expects($this->once()) ->method('chartUrl') ->willReturn('https://www.example.com'); $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(FanChartModule::class) + ->expects($this->once()) + ->method('findByComponent') + ->with(ModuleChartInterface::class) ->willReturn(new Collection([$module])); $handler = new RedirectFanChartPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $response = $handler->handle($request); @@ -90,26 +88,26 @@ class RedirectFanChartPhpTest extends TestCase public function testModuleDisabled(): void { - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once())->method('findByInterface') - ->with(FanChartModule::class) - ->willReturn(new Collection()); - $tree = $this->createMock(Tree::class); + $tree + ->method('name') + ->willReturn('tree1'); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); + + $module_service = $this->createMock(ModuleService::class); + $module_service + ->expects($this->once())->method('findByComponent') + ->with(ModuleChartInterface::class) + ->willReturn(new Collection()); $handler = new RedirectFanChartPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $this->expectException(HttpGoneException::class); @@ -118,27 +116,17 @@ class RedirectFanChartPhpTest extends TestCase public function testNoSuchTree(): void { - $module = $this->createMock(FanChartModule::class); - - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(FanChartModule::class) - ->willReturn(new Collection([$module])); - $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); + $module_service = $this->createMock(ModuleService::class); + $handler = new RedirectFanChartPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $this->expectException(HttpGoneException::class); diff --git a/tests/app/Http/RequestHandlers/RedirectGedRecordPhpTest.php b/tests/app/Http/RequestHandlers/RedirectGedRecordPhpTest.php index f96446b85b..e99d793f64 100644 --- a/tests/app/Http/RequestHandlers/RedirectGedRecordPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectGedRecordPhpTest.php @@ -46,7 +46,7 @@ class RedirectGedRecordPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -57,7 +57,7 @@ class RedirectGedRecordPhpTest extends TestCase $gedcom_record_factory = $this->createMock(GedcomRecordFactory::class); $gedcom_record_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn($gedcom_record); @@ -83,9 +83,9 @@ class RedirectGedRecordPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); $handler = new RedirectGedRecordPhp($tree_service); diff --git a/tests/app/Http/RequestHandlers/RedirectHourGlassPhpTest.php b/tests/app/Http/RequestHandlers/RedirectHourGlassPhpTest.php index 896f1ce824..216846d153 100644 --- a/tests/app/Http/RequestHandlers/RedirectHourGlassPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectHourGlassPhpTest.php @@ -25,6 +25,7 @@ use Fisharebest\Webtrees\Factories\IndividualFactory; use Fisharebest\Webtrees\Http\Exceptions\HttpGoneException; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\Module\HourglassChartModule; +use Fisharebest\Webtrees\Module\ModuleChartInterface; use Fisharebest\Webtrees\Registry; use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\TreeService; @@ -47,7 +48,7 @@ class RedirectHourGlassPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -55,7 +56,7 @@ class RedirectHourGlassPhpTest extends TestCase $individual_factory = $this->createMock(IndividualFactory::class); $individual_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn($individual); @@ -64,23 +65,20 @@ class RedirectHourGlassPhpTest extends TestCase $module = $this->createMock(HourglassChartModule::class); $module - ->expects(self::once()) + ->expects($this->once()) ->method('chartUrl') ->willReturn('https://www.example.com'); $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(HourglassChartModule::class) + ->expects($this->once()) + ->method('findByComponent') + ->with(ModuleChartInterface::class) ->willReturn(new Collection([$module])); $handler = new RedirectHourGlassPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $response = $handler->handle($request); @@ -92,24 +90,21 @@ class RedirectHourGlassPhpTest extends TestCase { $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once())->method('findByInterface') - ->with(HourglassChartModule::class) + ->expects($this->once())->method('findByComponent') + ->with(ModuleChartInterface::class) ->willReturn(new Collection()); $tree = $this->createMock(Tree::class); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); $handler = new RedirectHourGlassPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $this->expectException(HttpGoneException::class); @@ -118,27 +113,17 @@ class RedirectHourGlassPhpTest extends TestCase public function testNoSuchTree(): void { - $module = $this->createMock(HourglassChartModule::class); - - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(HourglassChartModule::class) - ->willReturn(new Collection([$module])); + $module_service = $this->createMock(ModuleService::class); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); $handler = new RedirectHourGlassPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $this->expectException(HttpGoneException::class); diff --git a/tests/app/Http/RequestHandlers/RedirectIndiListPhpTest.php b/tests/app/Http/RequestHandlers/RedirectIndiListPhpTest.php index db56286e7c..c1b09d1d59 100644 --- a/tests/app/Http/RequestHandlers/RedirectIndiListPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectIndiListPhpTest.php @@ -21,8 +21,10 @@ namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; +use Fisharebest\Webtrees\GuestUser; use Fisharebest\Webtrees\Http\Exceptions\HttpGoneException; use Fisharebest\Webtrees\Module\IndividualListModule; +use Fisharebest\Webtrees\Module\ModuleListInterface; use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\TreeService; use Fisharebest\Webtrees\TestCase; @@ -44,21 +46,21 @@ class RedirectIndiListPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); $module = $this->createMock(IndividualListModule::class); $module - ->expects(self::once()) + ->expects($this->once()) ->method('listUrl') ->willReturn('https://www.example.com'); $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(IndividualListModule::class) + ->expects($this->once()) + ->method('findByComponent') + ->with(ModuleListInterface::class, $tree, new GuestUser()) ->willReturn(new Collection([$module])); $handler = new RedirectIndiListPhp($module_service, $tree_service); @@ -73,19 +75,22 @@ class RedirectIndiListPhpTest extends TestCase public function testModuleDisabled(): void { - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once())->method('findByInterface') - ->with(IndividualListModule::class) - ->willReturn(new Collection()); - $tree = $this->createMock(Tree::class); + $tree + ->method('name') + ->willReturn('tree1'); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); + + $module_service = $this->createMock(ModuleService::class); + $module_service + ->method('findByComponent') + ->with(ModuleListInterface::class, $tree, new GuestUser()) + ->willReturn(new Collection()); $handler = new RedirectIndiListPhp($module_service, $tree_service); @@ -98,18 +103,11 @@ class RedirectIndiListPhpTest extends TestCase public function testNoSuchTree(): void { - $module = $this->createMock(IndividualListModule::class); - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(IndividualListModule::class) - ->willReturn(new Collection([$module])); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); diff --git a/tests/app/Http/RequestHandlers/RedirectIndividualPhpTest.php b/tests/app/Http/RequestHandlers/RedirectIndividualPhpTest.php index eb205f50a5..1128850edc 100644 --- a/tests/app/Http/RequestHandlers/RedirectIndividualPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectIndividualPhpTest.php @@ -46,7 +46,7 @@ class RedirectIndividualPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -57,7 +57,7 @@ class RedirectIndividualPhpTest extends TestCase $individual_factory = $this->createMock(IndividualFactory::class); $individual_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn($individual); @@ -66,10 +66,7 @@ class RedirectIndividualPhpTest extends TestCase $handler = new RedirectIndividualPhp($tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'pid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'pid' => 'X123']); $response = $handler->handle($request); @@ -83,16 +80,13 @@ class RedirectIndividualPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); $handler = new RedirectIndividualPhp($tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'pid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'pid' => 'X123']); $this->expectException(HttpGoneException::class); @@ -103,16 +97,13 @@ class RedirectIndividualPhpTest extends TestCase { $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); $handler = new RedirectIndividualPhp($tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'pid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'pid' => 'X123']); $this->expectException(HttpGoneException::class); diff --git a/tests/app/Http/RequestHandlers/RedirectLifeSpanPhpTest.php b/tests/app/Http/RequestHandlers/RedirectLifeSpanPhpTest.php index a5371e4224..9d7b506c43 100644 --- a/tests/app/Http/RequestHandlers/RedirectLifeSpanPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectLifeSpanPhpTest.php @@ -23,6 +23,7 @@ use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; use Fisharebest\Webtrees\Http\Exceptions\HttpGoneException; use Fisharebest\Webtrees\Module\LifespansChartModule; +use Fisharebest\Webtrees\Module\ModuleChartInterface; use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\TreeService; use Fisharebest\Webtrees\TestCase; @@ -44,29 +45,26 @@ class RedirectLifeSpanPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); $module = $this->createMock(LifespansChartModule::class); $module - ->expects(self::once()) + ->expects($this->once()) ->method('chartUrl') ->willReturn('https://www.example.com'); $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(LifespansChartModule::class) + ->expects($this->once()) + ->method('findByComponent') + ->with(ModuleChartInterface::class) ->willReturn(new Collection([$module])); $handler = new RedirectLifeSpanPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $response = $handler->handle($request); @@ -78,24 +76,21 @@ class RedirectLifeSpanPhpTest extends TestCase { $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once())->method('findByInterface') - ->with(LifespansChartModule::class) + ->expects($this->once())->method('findByComponent') + ->with(ModuleChartInterface::class) ->willReturn(new Collection()); $tree = $this->createMock(Tree::class); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); $handler = new RedirectLifeSpanPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $this->expectException(HttpGoneException::class); @@ -104,27 +99,17 @@ class RedirectLifeSpanPhpTest extends TestCase public function testNoSuchTree(): void { - $module = $this->createMock(LifespansChartModule::class); - - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(LifespansChartModule::class) - ->willReturn(new Collection([$module])); + $module_service = $this->createMock(ModuleService::class); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); $handler = new RedirectLifeSpanPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $this->expectException(HttpGoneException::class); diff --git a/tests/app/Http/RequestHandlers/RedirectMediaListPhpTest.php b/tests/app/Http/RequestHandlers/RedirectMediaListPhpTest.php index ec6f0b0b34..bc4e4a1efe 100644 --- a/tests/app/Http/RequestHandlers/RedirectMediaListPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectMediaListPhpTest.php @@ -21,8 +21,10 @@ namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; +use Fisharebest\Webtrees\GuestUser; use Fisharebest\Webtrees\Http\Exceptions\HttpGoneException; use Fisharebest\Webtrees\Module\MediaListModule; +use Fisharebest\Webtrees\Module\ModuleListInterface; use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\TreeService; use Fisharebest\Webtrees\TestCase; @@ -44,21 +46,21 @@ class RedirectMediaListPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); $module = $this->createMock(MediaListModule::class); $module - ->expects(self::once()) + ->expects($this->once()) ->method('listUrl') ->willReturn('https://www.example.com'); $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(MediaListModule::class) + ->expects($this->once()) + ->method('findByComponent') + ->with(ModuleListInterface::class) ->willReturn(new Collection([$module])); $handler = new RedirectMediaListPhp($module_service, $tree_service); @@ -73,19 +75,22 @@ class RedirectMediaListPhpTest extends TestCase public function testModuleDisabled(): void { - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once())->method('findByInterface') - ->with(MediaListModule::class) - ->willReturn(new Collection()); - $tree = $this->createMock(Tree::class); + $tree + ->method('name') + ->willReturn('tree1'); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); + + $module_service = $this->createMock(ModuleService::class); + $module_service + ->method('findByComponent') + ->with(ModuleListInterface::class, $tree, new GuestUser()) + ->willReturn(new Collection()); $handler = new RedirectMediaListPhp($module_service, $tree_service); @@ -98,18 +103,11 @@ class RedirectMediaListPhpTest extends TestCase public function testNoSuchTree(): void { - $module = $this->createMock(MediaListModule::class); - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(MediaListModule::class) - ->willReturn(new Collection([$module])); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); diff --git a/tests/app/Http/RequestHandlers/RedirectMediaViewerPhpTest.php b/tests/app/Http/RequestHandlers/RedirectMediaViewerPhpTest.php index 269e361d66..6f9d79dafa 100644 --- a/tests/app/Http/RequestHandlers/RedirectMediaViewerPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectMediaViewerPhpTest.php @@ -46,7 +46,7 @@ class RedirectMediaViewerPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -57,7 +57,7 @@ class RedirectMediaViewerPhpTest extends TestCase $media_factory = $this->createMock(MediaFactory::class); $media_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn($media); @@ -66,10 +66,7 @@ class RedirectMediaViewerPhpTest extends TestCase $handler = new RedirectMediaViewerPhp($tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'mid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'mid' => 'X123']); $response = $handler->handle($request); @@ -83,16 +80,13 @@ class RedirectMediaViewerPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); $handler = new RedirectMediaViewerPhp($tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'mid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'mid' => 'X123']); $this->expectException(HttpGoneException::class); @@ -103,16 +97,13 @@ class RedirectMediaViewerPhpTest extends TestCase { $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); $handler = new RedirectMediaViewerPhp($tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'mid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'mid' => 'X123']); $this->expectException(HttpGoneException::class); diff --git a/tests/app/Http/RequestHandlers/RedirectModulePhpTest.php b/tests/app/Http/RequestHandlers/RedirectModulePhpTest.php index 9f508bd6ee..6b20c2abf7 100644 --- a/tests/app/Http/RequestHandlers/RedirectModulePhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectModulePhpTest.php @@ -25,6 +25,7 @@ use Fisharebest\Webtrees\Factories\IndividualFactory; use Fisharebest\Webtrees\Http\Exceptions\HttpGoneException; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\Module\InteractiveTreeModule; +use Fisharebest\Webtrees\Module\ModuleListInterface; use Fisharebest\Webtrees\Module\PedigreeMapModule; use Fisharebest\Webtrees\Registry; use Fisharebest\Webtrees\Services\ModuleService; @@ -48,7 +49,7 @@ class RedirectModulePhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -56,7 +57,7 @@ class RedirectModulePhpTest extends TestCase $individual_factory = $this->createMock(IndividualFactory::class); $individual_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn($individual); @@ -65,14 +66,14 @@ class RedirectModulePhpTest extends TestCase $module = $this->createMock(PedigreeMapModule::class); $module - ->expects(self::once()) + ->expects($this->once()) ->method('chartUrl') ->willReturn('https://www.example.com'); $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) - ->method('findByInterface') + ->expects($this->once()) + ->method('findByinterface') ->with(PedigreeMapModule::class) ->willReturn(new Collection([$module])); @@ -98,7 +99,7 @@ class RedirectModulePhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -106,7 +107,7 @@ class RedirectModulePhpTest extends TestCase $individual_factory = $this->createMock(IndividualFactory::class); $individual_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn($individual); @@ -115,13 +116,13 @@ class RedirectModulePhpTest extends TestCase $module = $this->createMock(InteractiveTreeModule::class); $module - ->expects(self::once()) + ->expects($this->once()) ->method('chartUrl') ->willReturn('https://www.example.com'); $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) + ->expects($this->once()) ->method('findByInterface') ->with(InteractiveTreeModule::class) ->willReturn(new Collection([$module])); @@ -144,7 +145,7 @@ class RedirectModulePhpTest extends TestCase $module_service = $this->createMock(ModuleService::class); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); @@ -169,7 +170,7 @@ class RedirectModulePhpTest extends TestCase $individual_factory = $this->createMock(IndividualFactory::class); $individual_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn(null); @@ -178,7 +179,7 @@ class RedirectModulePhpTest extends TestCase $module_service = $this->createMock(ModuleService::class); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -203,7 +204,7 @@ class RedirectModulePhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -211,7 +212,7 @@ class RedirectModulePhpTest extends TestCase $individual_factory = $this->createMock(IndividualFactory::class); $individual_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn($individual); @@ -220,7 +221,7 @@ class RedirectModulePhpTest extends TestCase $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) + ->expects($this->once()) ->method('findByInterface') ->with(PedigreeMapModule::class) ->willReturn(new Collection([])); @@ -246,7 +247,7 @@ class RedirectModulePhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -254,7 +255,7 @@ class RedirectModulePhpTest extends TestCase $individual_factory = $this->createMock(IndividualFactory::class); $individual_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn($individual); @@ -263,7 +264,7 @@ class RedirectModulePhpTest extends TestCase $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) + ->expects($this->once()) ->method('findByInterface') ->with(InteractiveTreeModule::class) ->willReturn(new Collection([])); diff --git a/tests/app/Http/RequestHandlers/RedirectNoteListPhpTest.php b/tests/app/Http/RequestHandlers/RedirectNoteListPhpTest.php index a550135eb9..1ed405d25b 100644 --- a/tests/app/Http/RequestHandlers/RedirectNoteListPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectNoteListPhpTest.php @@ -21,7 +21,9 @@ namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; +use Fisharebest\Webtrees\GuestUser; use Fisharebest\Webtrees\Http\Exceptions\HttpGoneException; +use Fisharebest\Webtrees\Module\ModuleListInterface; use Fisharebest\Webtrees\Module\NoteListModule; use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\TreeService; @@ -44,21 +46,21 @@ class RedirectNoteListPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); $module = $this->createMock(NoteListModule::class); $module - ->expects(self::once()) + ->expects($this->once()) ->method('listUrl') ->willReturn('https://www.example.com'); $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(NoteListModule::class) + ->expects($this->once()) + ->method('findByComponent') + ->with(ModuleListInterface::class) ->willReturn(new Collection([$module])); $handler = new RedirectNoteListPhp($module_service, $tree_service); @@ -73,19 +75,22 @@ class RedirectNoteListPhpTest extends TestCase public function testModuleDisabled(): void { - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once())->method('findByInterface') - ->with(NoteListModule::class) - ->willReturn(new Collection()); - $tree = $this->createMock(Tree::class); + $tree + ->method('name') + ->willReturn('tree1'); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); + + $module_service = $this->createMock(ModuleService::class); + $module_service + ->method('findByComponent') + ->with(ModuleListInterface::class, $tree, new GuestUser()) + ->willReturn(new Collection()); $handler = new RedirectNoteListPhp($module_service, $tree_service); @@ -98,18 +103,11 @@ class RedirectNoteListPhpTest extends TestCase public function testNoSuchTree(): void { - $module = $this->createMock(NoteListModule::class); - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(NoteListModule::class) - ->willReturn(new Collection([$module])); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); diff --git a/tests/app/Http/RequestHandlers/RedirectNotePhpTest.php b/tests/app/Http/RequestHandlers/RedirectNotePhpTest.php index 3e4b3ad582..fbf637e521 100644 --- a/tests/app/Http/RequestHandlers/RedirectNotePhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectNotePhpTest.php @@ -46,7 +46,7 @@ class RedirectNotePhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -57,7 +57,7 @@ class RedirectNotePhpTest extends TestCase $note_factory = $this->createMock(NoteFactory::class); $note_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn($note); @@ -66,10 +66,7 @@ class RedirectNotePhpTest extends TestCase $handler = new RedirectNotePhp($tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'nid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'nid' => 'X123']); $response = $handler->handle($request); @@ -83,16 +80,13 @@ class RedirectNotePhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); $handler = new RedirectNotePhp($tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'nid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'nid' => 'X123']); $this->expectException(HttpGoneException::class); diff --git a/tests/app/Http/RequestHandlers/RedirectPedigreePhpTest.php b/tests/app/Http/RequestHandlers/RedirectPedigreePhpTest.php index 356fd787cd..bca8b0268f 100644 --- a/tests/app/Http/RequestHandlers/RedirectPedigreePhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectPedigreePhpTest.php @@ -22,8 +22,10 @@ namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; use Fisharebest\Webtrees\Factories\IndividualFactory; +use Fisharebest\Webtrees\GuestUser; use Fisharebest\Webtrees\Http\Exceptions\HttpGoneException; use Fisharebest\Webtrees\Individual; +use Fisharebest\Webtrees\Module\ModuleChartInterface; use Fisharebest\Webtrees\Module\PedigreeChartModule; use Fisharebest\Webtrees\Registry; use Fisharebest\Webtrees\Services\ModuleService; @@ -47,7 +49,7 @@ class RedirectPedigreePhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -55,7 +57,7 @@ class RedirectPedigreePhpTest extends TestCase $individual_factory = $this->createMock(IndividualFactory::class); $individual_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn($individual); @@ -64,23 +66,20 @@ class RedirectPedigreePhpTest extends TestCase $module = $this->createMock(PedigreeChartModule::class); $module - ->expects(self::once()) + ->expects($this->once()) ->method('chartUrl') ->willReturn('https://www.example.com'); $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(PedigreeChartModule::class) + ->expects($this->once()) + ->method('findByComponent') + ->with(ModuleChartInterface::class) ->willReturn(new Collection([$module])); $handler = new RedirectPedigreePhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $response = $handler->handle($request); @@ -90,26 +89,26 @@ class RedirectPedigreePhpTest extends TestCase public function testModuleDisabled(): void { - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once())->method('findByInterface') - ->with(PedigreeChartModule::class) - ->willReturn(new Collection()); - $tree = $this->createMock(Tree::class); + $tree + ->method('name') + ->willReturn('tree1'); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); + + $module_service = $this->createMock(ModuleService::class); + $module_service + ->method('findByComponent') + ->with(ModuleChartInterface::class, $tree, new GuestUser()) + ->willReturn(new Collection()); $handler = new RedirectPedigreePhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $this->expectException(HttpGoneException::class); @@ -118,27 +117,17 @@ class RedirectPedigreePhpTest extends TestCase public function testNoSuchTree(): void { - $module = $this->createMock(PedigreeChartModule::class); - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(PedigreeChartModule::class) - ->willReturn(new Collection([$module])); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); $handler = new RedirectPedigreePhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rootid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rootid' => 'X123']); $this->expectException(HttpGoneException::class); diff --git a/tests/app/Http/RequestHandlers/RedirectPlaceListPhpTest.php b/tests/app/Http/RequestHandlers/RedirectPlaceListPhpTest.php index 5afda3237b..4c0c3a15fa 100644 --- a/tests/app/Http/RequestHandlers/RedirectPlaceListPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectPlaceListPhpTest.php @@ -21,7 +21,9 @@ namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; +use Fisharebest\Webtrees\GuestUser; use Fisharebest\Webtrees\Http\Exceptions\HttpGoneException; +use Fisharebest\Webtrees\Module\ModuleListInterface; use Fisharebest\Webtrees\Module\PlaceHierarchyListModule; use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\TreeService; @@ -44,21 +46,21 @@ class RedirectPlaceListPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); $module = $this->createMock(PlaceHierarchyListModule::class); $module - ->expects(self::once()) + ->expects($this->once()) ->method('listUrl') ->willReturn('https://www.example.com'); $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(PlaceHierarchyListModule::class) + ->expects($this->once()) + ->method('findByComponent') + ->with(ModuleListInterface::class) ->willReturn(new Collection([$module])); $handler = new RedirectPlaceListPhp($module_service, $tree_service); @@ -73,19 +75,22 @@ class RedirectPlaceListPhpTest extends TestCase public function testModuleDisabled(): void { - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once())->method('findByInterface') - ->with(PlaceHierarchyListModule::class) - ->willReturn(new Collection()); - $tree = $this->createMock(Tree::class); + $tree + ->method('name') + ->willReturn('tree1'); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); + + $module_service = $this->createMock(ModuleService::class); + $module_service + ->method('findByComponent') + ->with(ModuleListInterface::class, $tree, new GuestUser()) + ->willReturn(new Collection()); $handler = new RedirectPlaceListPhp($module_service, $tree_service); @@ -98,18 +103,11 @@ class RedirectPlaceListPhpTest extends TestCase public function testNoSuchTree(): void { - $module = $this->createMock(PlaceHierarchyListModule::class); - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(PlaceHierarchyListModule::class) - ->willReturn(new Collection([$module])); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); diff --git a/tests/app/Http/RequestHandlers/RedirectRelationshipPhpTest.php b/tests/app/Http/RequestHandlers/RedirectRelationshipPhpTest.php index d7154afa35..9d58322eb7 100644 --- a/tests/app/Http/RequestHandlers/RedirectRelationshipPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectRelationshipPhpTest.php @@ -22,8 +22,11 @@ namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; use Fisharebest\Webtrees\Factories\IndividualFactory; +use Fisharebest\Webtrees\GuestUser; use Fisharebest\Webtrees\Http\Exceptions\HttpGoneException; use Fisharebest\Webtrees\Individual; +use Fisharebest\Webtrees\Module\ModuleChartInterface; +use Fisharebest\Webtrees\Module\ModuleListInterface; use Fisharebest\Webtrees\Module\RelationshipsChartModule; use Fisharebest\Webtrees\Registry; use Fisharebest\Webtrees\Services\ModuleService; @@ -47,7 +50,7 @@ class RedirectRelationshipPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -55,7 +58,7 @@ class RedirectRelationshipPhpTest extends TestCase $individual_factory = $this->createMock(IndividualFactory::class); $individual_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn($individual); @@ -64,23 +67,20 @@ class RedirectRelationshipPhpTest extends TestCase $module = $this->createMock(RelationshipsChartModule::class); $module - ->expects(self::once()) + ->expects($this->once()) ->method('chartUrl') ->willReturn('https://www.example.com'); $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(RelationshipsChartModule::class) + ->expects($this->once()) + ->method('findByComponent') + ->with(ModuleChartInterface::class) ->willReturn(new Collection([$module])); $handler = new RedirectRelationshipPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'pid1' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'pid1' => 'X123']); $response = $handler->handle($request); @@ -90,26 +90,26 @@ class RedirectRelationshipPhpTest extends TestCase public function testModuleDisabled(): void { - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once())->method('findByInterface') - ->with(RelationshipsChartModule::class) - ->willReturn(new Collection()); - $tree = $this->createMock(Tree::class); + $tree + ->method('name') + ->willReturn('tree1'); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); + + $module_service = $this->createMock(ModuleService::class); + $module_service + ->method('findByComponent') + ->with(ModuleChartInterface::class, $tree, new GuestUser()) + ->willReturn(new Collection()); $handler = new RedirectRelationshipPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'pid1' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'pid1' => 'X123']); $this->expectException(HttpGoneException::class); @@ -118,27 +118,17 @@ class RedirectRelationshipPhpTest extends TestCase public function testNoSuchTree(): void { - $module = $this->createMock(RelationshipsChartModule::class); - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(RelationshipsChartModule::class) - ->willReturn(new Collection([$module])); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); $handler = new RedirectRelationshipPhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'pid1' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'pid1' => 'X123']); $this->expectException(HttpGoneException::class); diff --git a/tests/app/Http/RequestHandlers/RedirectRepoListPhpTest.php b/tests/app/Http/RequestHandlers/RedirectRepoListPhpTest.php index 10a7c52e44..4831af8782 100644 --- a/tests/app/Http/RequestHandlers/RedirectRepoListPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectRepoListPhpTest.php @@ -21,7 +21,9 @@ namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; +use Fisharebest\Webtrees\GuestUser; use Fisharebest\Webtrees\Http\Exceptions\HttpGoneException; +use Fisharebest\Webtrees\Module\ModuleListInterface; use Fisharebest\Webtrees\Module\RepositoryListModule; use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\TreeService; @@ -44,21 +46,21 @@ class RedirectRepoListPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); $module = $this->createMock(RepositoryListModule::class); $module - ->expects(self::once()) + ->expects($this->once()) ->method('listUrl') ->willReturn('https://www.example.com'); $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(RepositoryListModule::class) + ->expects($this->once()) + ->method('findByComponent') + ->with(ModuleListInterface::class) ->willReturn(new Collection([$module])); $handler = new RedirectRepoListPhp($module_service, $tree_service); @@ -73,19 +75,22 @@ class RedirectRepoListPhpTest extends TestCase public function testModuleDisabled(): void { - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once())->method('findByInterface') - ->with(RepositoryListModule::class) - ->willReturn(new Collection()); - $tree = $this->createMock(Tree::class); + $tree + ->method('name') + ->willReturn('tree1'); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); + + $module_service = $this->createMock(ModuleService::class); + $module_service + ->method('findByComponent') + ->with(ModuleListInterface::class, $tree, new GuestUser()) + ->willReturn(new Collection()); $handler = new RedirectRepoListPhp($module_service, $tree_service); @@ -98,18 +103,11 @@ class RedirectRepoListPhpTest extends TestCase public function testNoSuchTree(): void { - $module = $this->createMock(RepositoryListModule::class); - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(RepositoryListModule::class) - ->willReturn(new Collection([$module])); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); diff --git a/tests/app/Http/RequestHandlers/RedirectReportEnginePhpTest.php b/tests/app/Http/RequestHandlers/RedirectReportEnginePhpTest.php index 399c9b4f4b..30ef502ed0 100644 --- a/tests/app/Http/RequestHandlers/RedirectReportEnginePhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectReportEnginePhpTest.php @@ -42,7 +42,7 @@ class RedirectReportEnginePhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -69,7 +69,7 @@ class RedirectReportEnginePhpTest extends TestCase { $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); diff --git a/tests/app/Http/RequestHandlers/RedirectRepositoryPhpTest.php b/tests/app/Http/RequestHandlers/RedirectRepositoryPhpTest.php index bfd2450663..f1aebd2e3e 100644 --- a/tests/app/Http/RequestHandlers/RedirectRepositoryPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectRepositoryPhpTest.php @@ -46,7 +46,7 @@ class RedirectRepositoryPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -57,7 +57,7 @@ class RedirectRepositoryPhpTest extends TestCase $repository_factory = $this->createMock(RepositoryFactory::class); $repository_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn($repository); @@ -66,10 +66,7 @@ class RedirectRepositoryPhpTest extends TestCase $handler = new RedirectRepositoryPhp($tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rid' => 'X123']); $response = $handler->handle($request); @@ -83,16 +80,13 @@ class RedirectRepositoryPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); $handler = new RedirectRepositoryPhp($tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'rid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'rid' => 'X123']); $this->expectException(HttpGoneException::class); diff --git a/tests/app/Http/RequestHandlers/RedirectSourceListPhpTest.php b/tests/app/Http/RequestHandlers/RedirectSourceListPhpTest.php index 5bcc1de965..dd4b5011a2 100644 --- a/tests/app/Http/RequestHandlers/RedirectSourceListPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectSourceListPhpTest.php @@ -21,7 +21,9 @@ namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; +use Fisharebest\Webtrees\GuestUser; use Fisharebest\Webtrees\Http\Exceptions\HttpGoneException; +use Fisharebest\Webtrees\Module\ModuleListInterface; use Fisharebest\Webtrees\Module\SourceListModule; use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\TreeService; @@ -44,21 +46,21 @@ class RedirectSourceListPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); $module = $this->createMock(SourceListModule::class); $module - ->expects(self::once()) + ->expects($this->once()) ->method('listUrl') ->willReturn('https://www.example.com'); $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(SourceListModule::class) + ->expects($this->once()) + ->method('findByComponent') + ->with(ModuleListInterface::class) ->willReturn(new Collection([$module])); $handler = new RedirectSourceListPhp($module_service, $tree_service); @@ -73,19 +75,22 @@ class RedirectSourceListPhpTest extends TestCase public function testModuleDisabled(): void { - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once())->method('findByInterface') - ->with(SourceListModule::class) - ->willReturn(new Collection()); - $tree = $this->createMock(Tree::class); + $tree + ->method('name') + ->willReturn('tree1'); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); + + $module_service = $this->createMock(ModuleService::class); + $module_service + ->method('findByComponent') + ->with(ModuleListInterface::class, $tree, new GuestUser()) + ->willReturn(new Collection()); $handler = new RedirectSourceListPhp($module_service, $tree_service); @@ -98,18 +103,11 @@ class RedirectSourceListPhpTest extends TestCase public function testNoSuchTree(): void { - $module = $this->createMock(SourceListModule::class); - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(SourceListModule::class) - ->willReturn(new Collection([$module])); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); diff --git a/tests/app/Http/RequestHandlers/RedirectSourcePhpTest.php b/tests/app/Http/RequestHandlers/RedirectSourcePhpTest.php index 4dc2b8c94f..9f565c3f02 100644 --- a/tests/app/Http/RequestHandlers/RedirectSourcePhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectSourcePhpTest.php @@ -46,7 +46,7 @@ class RedirectSourcePhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -57,7 +57,7 @@ class RedirectSourcePhpTest extends TestCase $source_factory = $this->createMock(SourceFactory::class); $source_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn($source); @@ -66,10 +66,7 @@ class RedirectSourcePhpTest extends TestCase $handler = new RedirectSourcePhp($tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'sid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'sid' => 'X123']); $response = $handler->handle($request); @@ -83,16 +80,13 @@ class RedirectSourcePhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); $handler = new RedirectSourcePhp($tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'sid' => 'X123'] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'sid' => 'X123']); $this->expectException(HttpGoneException::class); diff --git a/tests/app/Http/RequestHandlers/RedirectStatisticsPhpTest.php b/tests/app/Http/RequestHandlers/RedirectStatisticsPhpTest.php index 14aa742f00..305cbe8144 100644 --- a/tests/app/Http/RequestHandlers/RedirectStatisticsPhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectStatisticsPhpTest.php @@ -21,7 +21,10 @@ namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; +use Fisharebest\Webtrees\GuestUser; use Fisharebest\Webtrees\Http\Exceptions\HttpGoneException; +use Fisharebest\Webtrees\Module\ModuleChartInterface; +use Fisharebest\Webtrees\Module\ModuleListInterface; use Fisharebest\Webtrees\Module\StatisticsChartModule; use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\TreeService; @@ -44,21 +47,21 @@ class RedirectStatisticsPhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); $module = $this->createMock(StatisticsChartModule::class); $module - ->expects(self::once()) + ->expects($this->once()) ->method('chartUrl') ->willReturn('https://www.example.com'); $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(StatisticsChartModule::class) + ->expects($this->once()) + ->method('findByComponent') + ->with(ModuleChartInterface::class) ->willReturn(new Collection([$module])); $handler = new RedirectStatisticsPhp($module_service, $tree_service); @@ -73,19 +76,22 @@ class RedirectStatisticsPhpTest extends TestCase public function testModuleDisabled(): void { - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once())->method('findByInterface') - ->with(StatisticsChartModule::class) - ->willReturn(new Collection()); - $tree = $this->createMock(Tree::class); + $tree + ->method('name') + ->willReturn('tree1'); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); + + $module_service = $this->createMock(ModuleService::class); + $module_service + ->method('findByComponent') + ->with(ModuleChartInterface::class, $tree, new GuestUser()) + ->willReturn(new Collection()); $handler = new RedirectStatisticsPhp($module_service, $tree_service); @@ -98,18 +104,11 @@ class RedirectStatisticsPhpTest extends TestCase public function testNoSuchTree(): void { - $module = $this->createMock(StatisticsChartModule::class); - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(StatisticsChartModule::class) - ->willReturn(new Collection([$module])); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); diff --git a/tests/app/Http/RequestHandlers/RedirectTimeLinePhpTest.php b/tests/app/Http/RequestHandlers/RedirectTimeLinePhpTest.php index ee3440622b..e8fef96218 100644 --- a/tests/app/Http/RequestHandlers/RedirectTimeLinePhpTest.php +++ b/tests/app/Http/RequestHandlers/RedirectTimeLinePhpTest.php @@ -22,8 +22,11 @@ namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; use Fisharebest\Webtrees\Factories\IndividualFactory; +use Fisharebest\Webtrees\GuestUser; use Fisharebest\Webtrees\Http\Exceptions\HttpGoneException; use Fisharebest\Webtrees\Individual; +use Fisharebest\Webtrees\Module\ModuleChartInterface; +use Fisharebest\Webtrees\Module\ModuleListInterface; use Fisharebest\Webtrees\Module\TimelineChartModule; use Fisharebest\Webtrees\Registry; use Fisharebest\Webtrees\Services\ModuleService; @@ -47,7 +50,7 @@ class RedirectTimeLinePhpTest extends TestCase $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection(['tree1' => $tree])); @@ -55,7 +58,7 @@ class RedirectTimeLinePhpTest extends TestCase $individual_factory = $this->createMock(IndividualFactory::class); $individual_factory - ->expects(self::once()) + ->expects($this->once()) ->method('make') ->with('X123', $tree) ->willReturn($individual); @@ -64,23 +67,20 @@ class RedirectTimeLinePhpTest extends TestCase $module = $this->createMock(TimelineChartModule::class); $module - ->expects(self::once()) + ->expects($this->once()) ->method('chartUrl') ->willReturn('https://www.example.com'); $module_service = $this->createMock(ModuleService::class); $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(TimelineChartModule::class) + ->expects($this->once()) + ->method('findByComponent') + ->with(ModuleChartInterface::class) ->willReturn(new Collection([$module])); $handler = new RedirectTimeLinePhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'pids' => ['X123']] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'pids' => ['X123']]); $response = $handler->handle($request); @@ -90,26 +90,26 @@ class RedirectTimeLinePhpTest extends TestCase public function testModuleDisabled(): void { - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once())->method('findByInterface') - ->with(TimelineChartModule::class) - ->willReturn(new Collection()); - $tree = $this->createMock(Tree::class); + $tree + ->method('name') + ->willReturn('tree1'); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') - ->willReturn(new Collection([$tree])); + ->willReturn(new Collection(['tree1' => $tree])); + + $module_service = $this->createMock(ModuleService::class); + $module_service + ->method('findByComponent') + ->with(ModuleChartInterface::class, $tree, new GuestUser()) + ->willReturn(new Collection()); $handler = new RedirectTimeLinePhp($module_service, $tree_service); - $request = self::createRequest( - RequestMethodInterface::METHOD_GET, - ['ged' => 'tree1', 'pids' => ['X123']] - ); + $request = self::createRequest(RequestMethodInterface::METHOD_GET, ['ged' => 'tree1', 'pids' => ['X123']]); $this->expectException(HttpGoneException::class); @@ -118,18 +118,11 @@ class RedirectTimeLinePhpTest extends TestCase public function testNoSuchTree(): void { - $module = $this->createMock(TimelineChartModule::class); - $module_service = $this->createMock(ModuleService::class); - $module_service - ->expects(self::once()) - ->method('findByInterface') - ->with(TimelineChartModule::class) - ->willReturn(new Collection([$module])); $tree_service = $this->createMock(TreeService::class); $tree_service - ->expects(self::once()) + ->expects($this->once()) ->method('all') ->willReturn(new Collection([])); diff --git a/tests/app/Http/RequestHandlers/SelectThemeTest.php b/tests/app/Http/RequestHandlers/SelectThemeTest.php index 19f15261aa..d96ee3bf07 100644 --- a/tests/app/Http/RequestHandlers/SelectThemeTest.php +++ b/tests/app/Http/RequestHandlers/SelectThemeTest.php @@ -31,7 +31,7 @@ class SelectThemeTest extends TestCase public function testSelectThemeForGuest(): void { $user = $this->createMock(GuestUser::class); - $user->expects(self::once())->method('setPreference')->with('theme', 'FOO'); + $user->expects($this->once())->method('setPreference')->with('theme', 'FOO'); $request = self::createRequest() ->withAttribute('theme', 'FOO') @@ -46,7 +46,7 @@ class SelectThemeTest extends TestCase public function testSelectThemeForUser(): void { $user = $this->createMock(User::class); - $user->expects(self::once())->method('setPreference')->with('theme', 'FOO'); + $user->expects($this->once())->method('setPreference')->with('theme', 'FOO'); $request = self::createRequest() ->withAttribute('user', $user) |
