public function test_name_id_validator_is_called_when_name_id_present() { $subject = new Subject(); $nameId = new NameID(); $subject->setNameID($nameId); $nameIdValidatorMock = $this->getNameIdValidatorMock(); $nameIdValidatorMock->expects($this->once())->method('validateNameId')->with($nameId); $validator = new SubjectValidator($nameIdValidatorMock); $validator->validateSubject($subject); }