NumberOfReviewsRule example


class NumberOfReviewsRuleTest extends TestCase
{
    private NumberOfReviewsRule $rule;

    protected function setUp(): void
    {
        $this->rule = new NumberOfReviewsRule();
    }

    public function testGetConfig(): void
    {
        $config = (new NumberOfReviewsRule())->getConfig();
        static::assertEquals([
            'fields' => [
                [
                    'name' => 'count',
                    'type' => 'int',
                    'config' => [],
                ],

class NumberOfReviewsRuleTest extends TestCase
{
    use IntegrationTestBehaviour;

    private NumberOfReviewsRule $rule;

    protected function setUp(): void
    {
        $this->rule = new NumberOfReviewsRule();
    }

    public function testValidateWithMissingParameters(): void
    {
        try {
            $this->getContainer()->get('rule_condition.repository')->create([
                [
                    'type' => $this->rule->getName(),
                    'ruleId' => Uuid::randomHex(),
                ],
            ], Context::createDefaultContext());
            
Home | Imprint | This part of the site doesn't use cookies.