Skip to content

Commit

Permalink
Conditional onlyMethods / setMethods`
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Nov 26, 2024
1 parent 8528bb0 commit 001f635
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions test/Mustache/Test/Functional/HigherOrderSectionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,13 @@ public function testMonsters()

public function testPassthroughOptimization()
{
$mustache = $this->getMockBuilder('Mustache_Engine')
->onlyMethods(array('loadLambda'))
->getMock();
$mustache = $this->getMockBuilder('Mustache_Engine');
if (method_exists($mustache, 'onlyMethods')) {
$mustache->onlyMethods(array('loadLambda'));
} else {
$mustache->setMethods(array('loadLambda'));
}
$mustache = $mustache->getMock();

$mustache->expects($this->never())
->method('loadLambda');
Expand All @@ -92,9 +96,13 @@ public function testPassthroughOptimization()

public function testWithoutPassthroughOptimization()
{
$mustache = $this->getMockBuilder('Mustache_Engine')
->onlyMethods(array('loadLambda'))
->getMock();
$mustache = $this->getMockBuilder('Mustache_Engine');
if (method_exists($mustache, 'onlyMethods')) {
$mustache->onlyMethods(array('loadLambda'));
} else {
$mustache->setMethods(array('loadLambda'));
}
$mustache = $mustache->getMock();

$mustache->expects($this->once())
->method('loadLambda')
Expand Down

0 comments on commit 001f635

Please sign in to comment.