function RulesIntegrationTestBase::prophesizeEntity
Helper method to mock irrelevant cache methods on entities.
Parameters
string $interface: The interface that should be mocked, example: EntityInterface::class.
Return value
\Drupal\Core\Entity\EntityInterface|\Prophecy\Prophecy\ProphecyInterface The mocked entity.
42 calls to RulesIntegrationTestBase::prophesizeEntity()
- AutoSaveTest::testActionAutoSave in tests/
src/ Unit/ Integration/ Engine/ AutoSaveTest.php - Tests auto saving after an action execution.
- EntityDeleteTest::testActionExecution in tests/
src/ Unit/ Integration/ RulesAction/ EntityDeleteTest.php - Tests the action execution.
- EntityHasFieldTest::testConditionEvaluation in tests/
src/ Unit/ Integration/ Condition/ EntityHasFieldTest.php - Tests evaluating the condition.
- EntityIsNewTest::testConditionEvaluation in tests/
src/ Unit/ Integration/ Condition/ EntityIsNewTest.php - Tests evaluating the condition.
- EntityIsOfBundleTest::testConditionEvaluation in tests/
src/ Unit/ Integration/ Condition/ EntityIsOfBundleTest.php - Tests evaluating the condition.
File
-
tests/
src/ Unit/ Integration/ RulesIntegrationTestBase.php, line 373
Class
- RulesIntegrationTestBase
- Base class for Rules integration tests.
Namespace
Drupal\Tests\rules\Unit\IntegrationCode
protected function prophesizeEntity($interface) {
$entity = $this->prophesize($interface);
// Cache methods are irrelevant for the tests but might be called.
$entity->getCacheContexts()
->willReturn([]);
$entity->getCacheTags()
->willReturn([]);
$entity->getCacheMaxAge()
->willReturn(0);
return $entity;
}