/**
  * When table entries are passed then store them.
  */
 public function testWhenTableEntriesArePassedThenStoreThem()
 {
     $input = [\Mockery::mock(Table::class), \Mockery::mock(Table::class)];
     $instance = TableCollection::build($input);
     $helper = \ClassHelper::instance($instance);
     static::assertSame($input, $helper->entries);
 }
 /**
  * Will store input repository.
  */
 public function testWillStoreInputRepository()
 {
     $repository = \Mockery::mock(SchemaRepository::class);
     $instance = new SchemaService($repository);
     $helper = \ClassHelper::instance($instance);
     static::assertSame($repository, $helper->repository);
 }
 /**
  * When entries are passed then store them.
  */
 public function testWhenEntriesArePassedThenStoreThem()
 {
     $fields = [new TableField(), new TableField()];
     $response = TableFieldCollection::build($fields);
     $helper = \ClassHelper::instance($response);
     static::assertEquals($fields, $helper->entries);
 }
 protected function call()
 {
     $helper = \ClassHelper::instance($this->command);
     $helper->container = $this->container;
     $response = $helper->call('execute', [$this->input, $this->output]);
     return $response;
 }
 /**
  * When fields are instances of TableIndex then store the entries and return the instance.
  */
 public function testWhenFieldsAreInstancesOfTableIndexThenStoreTheEntriesAndReturnTheInstance()
 {
     $input = [new TableIndex(), new TableIndex(), new TableIndex()];
     $response = TableIndexCollection::build($input);
     static::assertInstanceOf(TableIndexCollection::class, $response);
     $helper = \ClassHelper::instance($response);
     static::assertEquals($input, $helper->entries);
 }
Пример #6
0
 /**
  * Will store a reflectionclass of the object in the target attribute.
  */
 public function testWillStoreAReflectionclassOfTheObjectInTheTargetAttribute()
 {
     $input = new \BadMethodCallException();
     $response = \ClassHelper::instance($input);
     /** @var \ReflectionClass $value */
     $value = \PHPUnit_Framework_Assert::readAttribute($response, 'target');
     static::assertInstanceOf(\ReflectionClass::class, $value);
     static::assertEquals('BadMethodCallException', $value->getName());
 }
 /**
  * Store entries.
  */
 public function testStoreEntries()
 {
     $name = StringLiteral::fromNative('sample_table_name');
     $fields = TableFieldCollection::build([]);
     $indexes = TableIndexCollection::build([]);
     $instance = Table::build($name, $fields, $indexes);
     static::assertInstanceOf(Table::class, $instance);
     $helper = \ClassHelper::instance($instance);
     static::assertSame($name, $helper->name);
     static::assertSame($fields, $helper->fields);
     static::assertSame($indexes, $helper->indexes);
 }
 /**
  * Store input fields values.
  */
 public function testStoreInputFieldsValues()
 {
     $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 = true;
     $indexType = new StringLiteral('sample-indexType');
     $comment = new StringLiteral('sample-comment');
     $indexComment = new StringLiteral('sample-indexComment');
     $response = TableIndex::build($table, $nonUnique, $keyName, $seqInIndex, $columnName, $collation, $cardinality, $subPart, $packed, $isNull, $indexType, $comment, $indexComment);
     // assert output type
     static::assertInstanceOf(TableIndex::class, $response);
     $helper = \ClassHelper::instance($response);
     // check stored values
     static::assertSame($table, $helper->table);
     static::assertSame($nonUnique, $helper->nonUnique);
     static::assertSame($keyName, $helper->keyName);
     static::assertSame($seqInIndex, $helper->seqInIndex);
     static::assertSame($columnName, $helper->columnName);
     static::assertSame($collation, $helper->collation);
     static::assertSame($cardinality, $helper->cardinality);
     static::assertSame($subPart, $helper->subPart);
     static::assertSame($packed, $helper->packed);
     static::assertSame($isNull, $helper->isNull);
     static::assertSame($indexType, $helper->indexType);
     static::assertSame($comment, $helper->comment);
     static::assertSame($indexComment, $helper->indexComment);
     // check output toArray
     $expected = ['table' => 'sample-table', 'nonUnique' => 'sample-nonUnique', 'keyName' => 'sample-keyName', 'seqInIndex' => 'sample-seqInIndex', 'columnName' => 'sample-columnName', 'collation' => 'sample-collation', 'cardinality' => 'sample-cardinality', 'subPart' => 'sample-subPart', 'packed' => 'sample-packed', 'isNull' => true, 'indexType' => 'sample-indexType', 'comment' => 'sample-comment', 'indexComment' => 'sample-indexComment'];
     static::assertEquals($expected, $response->toArray());
 }
Пример #9
0
 public function setUp()
 {
     $this->origin = new UnderTestGet();
     $this->instance = \ClassHelper::instance($this->origin);
 }
Пример #10
0
 public function setUp()
 {
     $this->instance = \ClassHelper::instance(new UnderTestGet());
 }