Example #1
0
 public function test_returns_edit_fields_as_array_with_key()
 {
     $this->dbalMock->shouldReceive('getTableColumns')->once()->andReturn(['id' => $this->columnMock, 'username' => $this->columnMock, 'password' => $this->columnMock, 'image' => $this->columnMock]);
     $this->dbalMock->shouldReceive('getTableForeignKeys')->andReturn([]);
     $this->dbalMock->shouldReceive('getModel')->andReturn($this->dbalMock);
     $this->dbalMock->shouldReceive('getKeyName')->andReturn(LaravelModel::CREATED_AT, LaravelModel::UPDATED_AT);
     $this->fieldFactoryMock->shouldReceive('setColumn', 'setConfig')->andReturn($this->fieldFactoryMock);
     $this->fieldFactoryMock->shouldReceive('get')->andReturn($this->mock('Anavel\\Crud\\Abstractor\\Eloquent\\Field'));
     $fields = $this->sut->getEditFields(false, 'chompy');
     $this->assertInternalType('array', $fields);
     $this->assertCount(5, $fields['chompy']);
     $this->assertArrayHasKey('username', $fields['chompy']);
     $this->assertInstanceOf('Anavel\\Crud\\Contracts\\Abstractor\\Field', $fields['chompy']['username']);
 }