Skip to content
This repository has been archived by the owner on Sep 20, 2019. It is now read-only.

Commit

Permalink
Merge 18cf8da into 8a9225f
Browse files Browse the repository at this point in the history
  • Loading branch information
addshore committed Nov 5, 2013
2 parents 8a9225f + 18cf8da commit ff7f661
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions tests/phpunit/Schema/Definition/FieldDefinitionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,71 @@ public function testConstructorSetsValues( array $constructorArgs ) {
);
}

public static function invalidNameProvider(){
return array(
array( 12 ),
array( array() ),
array( null ),
array( true ),
array( new \Exception() ),
);
}

/**
* @dataProvider invalidNameProvider
*/
public function testInvalidName( $name ) {
$this->setExpectedException( 'InvalidArgumentException' );
new FieldDefinition( $name, FieldDefinition::TYPE_INTEGER );
}

public static function invalidTypeProvider(){
return array(
array( 12 ),
array( array() ),
array( null ),
array( true ),
array( new \Exception() ),
);
}

/**
* @dataProvider invalidTypeProvider
*/
public function testInvalidType( $type ) {
$this->setExpectedException( 'InvalidArgumentException' );
new FieldDefinition( 'name', $type );
}

public static function invalidBoolProvider(){
return array(
array( 12 ),
array( array() ),
array( null ),
array( new \Exception() ),
);
}

/**
* @dataProvider invalidBoolProvider
*/
public function testInvalidNull( $null ) {
$this->setExpectedException( 'InvalidArgumentException' );
new FieldDefinition( 'name', FieldDefinition::TYPE_INTEGER, $null );
}

/**
* @dataProvider invalidBoolProvider
*/
public function testInvalidAutoIncrement( $autoinc ) {
$this->setExpectedException( 'InvalidArgumentException' );
new FieldDefinition(
'name',
FieldDefinition::TYPE_INTEGER,
FieldDefinition::NULL,
FieldDefinition::NO_DEFAULT,
FieldDefinition::NO_ATTRIB,
$autoinc
);
}
}

0 comments on commit ff7f661

Please sign in to comment.