/** * When the hostname is an IP then build credentials object. */ public function testWhenTheHostnameIsAnIPThenBuildObject() { $input = $this->username . ':' . $this->password . '@' . $this->hostnameIPv4 . '/' . $this->database; $mapper = new SchemaMapper(); $credentials = $mapper->buildCredentialsFromInlineFormat($input); static::assertEquals($this->hostnameIPv4, $credentials->getHost()); }
/** * When isNull is false build with null false. */ public function testWhenIsNullIsFalseBuildWithNullFalse() { /** @var TableIndex $response */ $response = $this->mapper->buildIndex($this->table, $this->nonUnique, $this->keyName, $this->seqInIndex, $this->columnName, $this->collation, $this->cardinality, $this->subPart, $this->packed, false, $this->indexType, $this->comment, $this->indexComment); $expected = $this->expected; $expected['isNull'] = false; static::assertEquals($expected, $response->toArray()); }
/** * Build field using input values. * @dataProvider dataProviderBooleanValues * @param boolean $bool */ public function testBuildFieldUsingInputValues($bool) { $name = 'sample-name'; $type = 'varchar(123)'; $key = 'sample-key'; $isNull = $bool; $default = 'sample-default'; $extra = 'sample-extra'; $mapper = new SchemaMapper(); $response = $mapper->buildField($name, $type, $isNull, $key, $default, $extra); $expected = ['name' => 'sample-name', 'type' => 'varchar(123)', 'null' => $bool, 'key' => 'sample-key', 'default' => 'sample-default', 'extra' => 'sample-extra']; static::assertInstanceOf(TableField::class, $response); static::assertEquals($expected, $response->toArray()); }
/** * When an empty array of field is given then return an empty collection. */ public function testWhenAnEmptyArrayOfIndexIsGivenThenReturnAnEmptyCollection() { $mapper = new SchemaMapper(); $response = $mapper->buildTableIndexCollectionFromPersistence([]); static::assertEquals([], $response->toArray()); }