/** * When the isNull parameter is not boolean then throw exception. * * @expectedException \InvalidArgumentException * @expectedExceptionMessage The isNull argument doesn't have a boolean value. */ public function testWhenTheIsNullParameterIsNotBooleanThenThrowException() { $table = new StringLiteral('sample-table'); $nonUnique = new StringLiteral('sample-nonUnique'); $keyName = new StringLiteral('sample-keyName'); $seqInIndex = new StringLiteral('sample-seqInIndex'); $columnName = new StringLiteral('sample-columnName'); $collation = new StringLiteral('sample-collation'); $cardinality = new StringLiteral('sample-cardinality'); $subPart = new StringLiteral('sample-subPart'); $packed = new StringLiteral('sample-packed'); $isNull = 'notbool'; $indexType = new StringLiteral('sample-indexType'); $comment = new StringLiteral('sample-comment'); $indexComment = new StringLiteral('sample-indexComment'); TableIndex::build($table, $nonUnique, $keyName, $seqInIndex, $columnName, $collation, $cardinality, $subPart, $packed, $isNull, $indexType, $comment, $indexComment); }
public function buildIndex($table, $nonUnique, $keyName, $seqInIndex, $columnName, $collation, $cardinality, $subPart, $packed, $isNull, $indexType, $comment, $indexComment) { $tableAttribute = StringLiteral::fromNative($table); $nonUniqueAttribute = StringLiteral::fromNative($nonUnique); $keyNameAttribute = StringLiteral::fromNative($keyName); $seqInIndexAttribute = StringLiteral::fromNative($seqInIndex); $columnNameAttribute = StringLiteral::fromNative($columnName); $collationAttribute = StringLiteral::fromNative($collation); $cardinalityAttribute = StringLiteral::fromNative($cardinality); $subPartAttribute = null === $subPart ? NullValue::create() : StringLiteral::fromNative($subPart); $packedAttribute = null === $packed ? NullValue::create() : StringLiteral::fromNative($packed); $isNullAttribute = (bool) $isNull; $indexTypeAttribute = StringLiteral::fromNative($indexType); $commentAttribute = StringLiteral::fromNative($comment); $indexCommentAttribute = StringLiteral::fromNative($indexComment); return TableIndex::build($tableAttribute, $nonUniqueAttribute, $keyNameAttribute, $seqInIndexAttribute, $columnNameAttribute, $collationAttribute, $cardinalityAttribute, $subPartAttribute, $packedAttribute, $isNullAttribute, $indexTypeAttribute, $commentAttribute, $indexCommentAttribute); }