mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-06 03:22:39 +00:00
simplify tests
This commit is contained in:
parent
3e8db7e5f7
commit
17bd465cae
15 changed files with 85 additions and 85 deletions
|
@ -629,11 +629,11 @@ class BehaviorCollectionTest extends CakeTestCase {
|
|||
$this->assertSame($Apple->Behaviors->enabled(), array());
|
||||
|
||||
$Apple->Sample->Behaviors->attach('Test');
|
||||
$this->assertSame($Apple->Sample->Behaviors->enabled('Test'), true);
|
||||
$this->assertTrue($Apple->Sample->Behaviors->enabled('Test'));
|
||||
$this->assertSame($Apple->Behaviors->enabled(), array());
|
||||
|
||||
$Apple->Behaviors->enable('Test');
|
||||
$this->assertSame($Apple->Behaviors->loaded('Test'), true);
|
||||
$this->assertTrue($Apple->Behaviors->loaded('Test'));
|
||||
$this->assertSame($Apple->Behaviors->enabled(), array('Test'));
|
||||
|
||||
$Apple->Behaviors->disable('Test');
|
||||
|
@ -658,7 +658,7 @@ class BehaviorCollectionTest extends CakeTestCase {
|
|||
$expected = $Apple->find('all');
|
||||
|
||||
$Apple->Behaviors->attach('Test');
|
||||
$this->assertSame($Apple->find('all'), null);
|
||||
$this->assertNull($Apple->find('all'));
|
||||
|
||||
$Apple->Behaviors->attach('Test', array('beforeFind' => 'off'));
|
||||
$this->assertSame($expected, $Apple->find('all'));
|
||||
|
@ -929,28 +929,28 @@ class BehaviorCollectionTest extends CakeTestCase {
|
|||
$Apple = new Apple();
|
||||
|
||||
$Apple->Behaviors->attach('Test', array('beforeFind' => 'off', 'beforeDelete' => 'off'));
|
||||
$this->assertSame($Apple->delete(6), true);
|
||||
$this->assertTrue($Apple->delete(6));
|
||||
|
||||
$Apple->Behaviors->attach('Test', array('beforeDelete' => 'on'));
|
||||
$this->assertSame($Apple->delete(4), false);
|
||||
$this->assertFalse($Apple->delete(4));
|
||||
|
||||
$Apple->Behaviors->attach('Test', array('beforeDelete' => 'test2'));
|
||||
|
||||
ob_start();
|
||||
$results = $Apple->delete(4);
|
||||
$this->assertSame(trim(ob_get_clean()), 'beforeDelete success (cascading)');
|
||||
$this->assertSame($results, true);
|
||||
$this->assertTrue($results);
|
||||
|
||||
ob_start();
|
||||
$results = $Apple->delete(3, false);
|
||||
$this->assertSame(trim(ob_get_clean()), 'beforeDelete success');
|
||||
$this->assertSame($results, true);
|
||||
$this->assertTrue($results);
|
||||
|
||||
$Apple->Behaviors->attach('Test', array('beforeDelete' => 'off', 'afterDelete' => 'on'));
|
||||
ob_start();
|
||||
$results = $Apple->delete(2, false);
|
||||
$this->assertSame(trim(ob_get_clean()), 'afterDelete success');
|
||||
$this->assertSame($results, true);
|
||||
$this->assertTrue($results);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -976,14 +976,14 @@ class BehaviorCollectionTest extends CakeTestCase {
|
|||
$Apple = new Apple();
|
||||
|
||||
$Apple->Behaviors->attach('Test');
|
||||
$this->assertSame($Apple->validates(), true);
|
||||
$this->assertTrue($Apple->validates());
|
||||
|
||||
$Apple->Behaviors->attach('Test', array('validate' => 'on'));
|
||||
$this->assertSame($Apple->validates(), false);
|
||||
$this->assertFalse($Apple->validates());
|
||||
$this->assertSame($Apple->validationErrors, array('name' => array(true)));
|
||||
|
||||
$Apple->Behaviors->attach('Test', array('validate' => 'stop'));
|
||||
$this->assertSame($Apple->validates(), false);
|
||||
$this->assertFalse($Apple->validates());
|
||||
$this->assertSame($Apple->validationErrors, array('name' => array(true, true)));
|
||||
|
||||
$Apple->Behaviors->attach('Test', array('validate' => 'whitelist'));
|
||||
|
@ -1004,10 +1004,10 @@ class BehaviorCollectionTest extends CakeTestCase {
|
|||
$Apple = new Apple();
|
||||
|
||||
$Apple->Behaviors->attach('Test');
|
||||
$this->assertSame($Apple->validates(), true);
|
||||
$this->assertTrue($Apple->validates());
|
||||
|
||||
$Apple->Behaviors->attach('Test', array('afterValidate' => 'on'));
|
||||
$this->assertSame($Apple->validates(), true);
|
||||
$this->assertTrue($Apple->validates());
|
||||
$this->assertSame($Apple->validationErrors, array());
|
||||
|
||||
$Apple->Behaviors->attach('Test', array('afterValidate' => 'test'));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue