Skip to content
Permalink
Browse files

Corrected uppercase and formatting issues

  • Loading branch information...
JayPHP committed Apr 9, 2016
1 parent 36c7d1c commit 0aced1a11b9a595aaf2046015de54647a5a3c313
Showing with 6 additions and 8 deletions.
  1. +1 −1 src/ORM/Rule/IsUnique.php
  2. +5 −7 tests/TestCase/ORM/RulesCheckerIntegrationTest.php
@@ -64,7 +64,7 @@ public function __invoke(EntityInterface $entity, array $options)
}
}
if($checkNull) {
if ($checkNull) {
foreach ($conditions as $key => $value) {
if ($value === null) {
$conditions[$key . ' IS'] = $value;
@@ -378,13 +378,12 @@ public function testIsUniqueMultipleFields()
public function testIsUniqueCheckNull()
{
$entity = new Entity([
'log_id' => NULL
'log_id' => null
]);
$table = TableRegistry::get('Logs');
$rules = $table->rulesChecker();
$rules->add($rules->isUnique(['log_id']),
['checkNull' => true]);
$rules->add($rules->isUnique(['log_id']), ['checkNull' => true]);
$this->assertFalse($table->save($entity));
$this->assertEquals(['_isUnique' => 'This value is already in use'], $entity->errors('log_id'));
@@ -407,13 +406,12 @@ public function testIsUniqueMultipleFieldsCheckNull()
{
$entity = new Entity([
'log_id' => 3,
'type' => NULL
'type' => null
]);
$table = TableRegistry::get('Logs');
$rules = $table->rulesChecker();
$rules->add($rules->isUnique(['log_id', 'type'], 'Nope'),
['checkNull' => true]);
$rules->add($rules->isUnique(['log_id', 'type'], 'Nope'), ['checkNull' => true]);
$this->assertFalse($table->save($entity));
$this->assertEquals(['log_id' => ['_isUnique' => 'Nope']], $entity->errors());
@@ -422,7 +420,7 @@ public function testIsUniqueMultipleFieldsCheckNull()
$entity->type = 'Access';
$this->assertSame($entity, $table->save($entity));
}
/**
* Tests the existsIn domain rule
*

0 comments on commit 0aced1a

Please sign in to comment.
You can’t perform that action at this time.