Exemplo n.º 1
0
 public function testIsTenantConstraint()
 {
     $scope = new TenantScope();
     $model = m::mock('Illuminate\\Database\\Eloquent\\Model');
     $tenantColumn = 'column';
     $tenantId = 1;
     $model->shouldReceive('getTenantWhereClause')->with($tenantColumn, $tenantId)->andReturn("table.column = '1'");
     $where = ['type' => 'raw', 'sql' => "table.column = '1'"];
     $this->assertTrue($scope->isTenantConstraint($model, $where, $tenantColumn, $tenantId));
     $where = ['type' => 'raw', 'sql' => "table.column = '2'"];
     $this->assertFalse($scope->isTenantConstraint($model, $where, $tenantColumn, $tenantId));
 }