|
@@ -2,7 +2,6 @@
|
|
|
|
|
|
|
|
namespace Tools\Model\Behavior;
|
|
namespace Tools\Model\Behavior;
|
|
|
|
|
|
|
|
-use Cake\Core\Configure;
|
|
|
|
|
use Cake\ORM\TableRegistry;
|
|
use Cake\ORM\TableRegistry;
|
|
|
use Tools\Model\Table\Table;
|
|
use Tools\Model\Table\Table;
|
|
|
use Tools\TestSuite\TestCase;
|
|
use Tools\TestSuite\TestCase;
|
|
@@ -30,8 +29,6 @@ class ResetBehaviorTest extends TestCase {
|
|
|
public function setUp() {
|
|
public function setUp() {
|
|
|
parent::setUp();
|
|
parent::setUp();
|
|
|
|
|
|
|
|
- Configure::write('App.namespace', 'TestApp');
|
|
|
|
|
-
|
|
|
|
|
$this->Table = TableRegistry::get('ResetComments');
|
|
$this->Table = TableRegistry::get('ResetComments');
|
|
|
$this->Table->addBehavior('Tools.Reset');
|
|
$this->Table->addBehavior('Tools.Reset');
|
|
|
}
|
|
}
|
|
@@ -142,7 +139,7 @@ class ResetBehaviorTest extends TestCase {
|
|
|
*/
|
|
*/
|
|
|
public function testResetWithStaticCallback() {
|
|
public function testResetWithStaticCallback() {
|
|
|
$this->Table->removeBehavior('Reset');
|
|
$this->Table->removeBehavior('Reset');
|
|
|
- $this->Table->addBehavior('Tools.Reset', ['callback' => 'TestApp\Model\Table\ResetCommentsTable::customStaticCallback']);
|
|
|
|
|
|
|
+ $this->Table->addBehavior('Tools.Reset', ['callback' => 'App\Model\Table\ResetCommentsTable::customStaticCallback']);
|
|
|
|
|
|
|
|
$x = $this->Table->find('first', ['conditions' => ['id' => 6]]);
|
|
$x = $this->Table->find('first', ['conditions' => ['id' => 6]]);
|
|
|
$this->assertEquals('Second Comment for Second Article', $x['comment']);
|
|
$this->assertEquals('Second Comment for Second Article', $x['comment']);
|
|
@@ -165,7 +162,7 @@ class ResetBehaviorTest extends TestCase {
|
|
|
$this->Table->addBehavior('Tools.Reset', [
|
|
$this->Table->addBehavior('Tools.Reset', [
|
|
|
'fields' => ['id'],
|
|
'fields' => ['id'],
|
|
|
'updateFields' => ['comment'],
|
|
'updateFields' => ['comment'],
|
|
|
- 'callback' => 'TestApp\Model\Table\ResetCommentsTable::fieldsCallback']);
|
|
|
|
|
|
|
+ 'callback' => 'App\Model\Table\ResetCommentsTable::fieldsCallback']);
|
|
|
|
|
|
|
|
$x = $this->Table->find('first', ['conditions' => ['id' => 6]]);
|
|
$x = $this->Table->find('first', ['conditions' => ['id' => 6]]);
|
|
|
$this->assertEquals('Second Comment for Second Article', $x['comment']);
|
|
$this->assertEquals('Second Comment for Second Article', $x['comment']);
|
|
@@ -188,7 +185,7 @@ class ResetBehaviorTest extends TestCase {
|
|
|
$this->Table->addBehavior('Tools.Reset', [
|
|
$this->Table->addBehavior('Tools.Reset', [
|
|
|
'fields' => ['id'],
|
|
'fields' => ['id'],
|
|
|
'updateFields' => ['id'],
|
|
'updateFields' => ['id'],
|
|
|
- 'callback' => 'TestApp\Model\Table\ResetCommentsTable::fieldsCallbackAuto']);
|
|
|
|
|
|
|
+ 'callback' => 'App\Model\Table\ResetCommentsTable::fieldsCallbackAuto']);
|
|
|
|
|
|
|
|
$x = $this->Table->find('first', ['conditions' => ['id' => 6]]);
|
|
$x = $this->Table->find('first', ['conditions' => ['id' => 6]]);
|
|
|
$this->assertEquals('Second Comment for Second Article', $x['comment']);
|
|
$this->assertEquals('Second Comment for Second Article', $x['comment']);
|