Permalink
Browse files

Fix isCreate()

It was backwards.
  • Loading branch information...
1 parent 9a54547 commit c31c9a04c36fef7d6f8518852a506c56ab1df65f @markstory markstory committed Feb 10, 2014
Showing with 3 additions and 3 deletions.
  1. +1 −1 src/View/Form/ArrayContext.php
  2. +2 −2 tests/TestCase/View/Form/ArrayContextTest.php
@@ -121,7 +121,7 @@ public function primaryKey() {
public function isCreate() {
$primary = $this->primaryKey();
foreach ($primary as $column) {
- if (!isset($this->_context['defaults'][$column])) {
+ if (!empty($this->_context['defaults'][$column])) {
return false;
}
}
@@ -79,11 +79,11 @@ public function testIsCreate() {
],
];
$context = new ArrayContext($this->request, $data);
- $this->assertFalse($context->isCreate());
+ $this->assertTrue($context->isCreate());
$data['defaults'] = ['id' => 2];
$context = new ArrayContext($this->request, $data);
- $this->assertTrue($context->isCreate());
+ $this->assertFalse($context->isCreate());
}
/**

0 comments on commit c31c9a0

Please sign in to comment.