[TYPO3-mvc] Testing validate annotations for domain objects

Michael Knoll mimi at kaktusteam.de
Tue Feb 2 14:14:31 CET 2010


Hi there,

my colleague and I just stumbled over writing tests for domain objects 
concerning validation. What we wanted to do was something like that:


public function setYearTest() {
	$this->setExpectedException('Exception');
	$album = new Tx_XYZ_Domain_Model_Album();
	$album->setYear('string');
}


while the corresponding property in the Album object has the following 
annotation:

/**
  * @var integer
  */
protected $year;


Even when adding @validate annotations, this property will not change 
the effect that there won't be any exceptions when setting non-numeric 
values.

What is your suggestion for testing such things. As far as I can see 
that, those validations only work together with mapping - am I right?

Any ideas?

Thanks for your comments!

Greetings

Michael


More information about the TYPO3-project-typo3v4mvc mailing list