installEntitySchema('user'); $this->installSchema('system', ['sequences']); $this->user = $this->createUser([]); } /** * Test the video embed constraint. */ public function testConstraint() { $entity = EntityTest::create(['user_id' => $this->user->id()]); $entity->{$this->fieldName}->value = 'invalid URL'; $violations = $entity->validate(); $this->assertCount(1, $violations); $this->assertInstanceOf(VideoEmbedConstraint::class, $violations[0]->getConstraint()); $entity->{$this->fieldName}->value = 'https://youtube.com/watch?v=fdbFV_Wup-Ssw'; $violations = $entity->validate(); $this->assertCount(0, $violations); } }