Skip to content

Commit

Permalink
Remove tests for methods that don't exist anymore.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Mar 18, 2014
1 parent 6a801b4 commit 7b096f0
Showing 1 changed file with 0 additions and 293 deletions.
293 changes: 0 additions & 293 deletions tests/TestCase/Console/Command/Task/ModelTaskTest.php
Expand Up @@ -368,299 +368,6 @@ public function testGetValidation() {
$this->assertEquals($expected, $result);
}

/**
* test that individual field validation works, with interactive = false
* tests the guessing features of validation
*
* @return void
*/
public function testFieldValidationGuessing() {
$this->markTestIncomplete('Not done here yet');
$this->Task->interactive = false;
$this->Task->initValidations();

$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
$expected = array('notEmpty' => 'notEmpty');
$this->assertEquals($expected, $result);

$result = $this->Task->fieldValidation('text', array('type' => 'date', 'length' => 10, 'null' => false));
$expected = array('date' => 'date');
$this->assertEquals($expected, $result);

$result = $this->Task->fieldValidation('text', array('type' => 'time', 'length' => 10, 'null' => false));
$expected = array('time' => 'time');
$this->assertEquals($expected, $result);

$result = $this->Task->fieldValidation('email', array('type' => 'string', 'length' => 10, 'null' => false));
$expected = array('email' => 'email');
$this->assertEquals($expected, $result);

$result = $this->Task->fieldValidation('test', array('type' => 'integer', 'length' => 10, 'null' => false));
$expected = array('numeric' => 'numeric');
$this->assertEquals($expected, $result);

$result = $this->Task->fieldValidation('test', array('type' => 'boolean', 'length' => 10, 'null' => false));
$expected = array('boolean' => 'boolean');
$this->assertEquals($expected, $result);
}

/**
* test that interactive field validation works and returns multiple validators.
*
* @return void
*/
public function testInteractiveFieldValidation() {
$this->markTestIncomplete('Not done here yet');
$this->Task->initValidations();
$this->Task->interactive = true;
$this->Task->expects($this->any())->method('in')
->will($this->onConsecutiveCalls('24', 'y', '18', 'n'));

$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
$expected = array('notEmpty' => 'notEmpty', 'maxLength' => 'maxLength');
$this->assertEquals($expected, $result);
}

/**
* test that a bogus response doesn't cause errors to bubble up.
*
* @return void
*/
public function testInteractiveFieldValidationWithBogusResponse() {
$this->markTestIncomplete('Not done here yet');
$this->_useMockedOut();
$this->Task->initValidations();
$this->Task->interactive = true;

$this->Task->expects($this->any())->method('in')
->will($this->onConsecutiveCalls('999999', '24', 'n'));

$this->Task->expects($this->at(10))->method('out')
->with($this->stringContains('make a valid'));

$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
$expected = array('notEmpty' => 'notEmpty');
$this->assertEquals($expected, $result);
}

/**
* test that a regular expression can be used for validation.
*
* @return void
*/
public function testInteractiveFieldValidationWithRegexp() {
$this->markTestIncomplete('Not done here yet');
$this->Task->initValidations();
$this->Task->interactive = true;
$this->Task->expects($this->any())->method('in')
->will($this->onConsecutiveCalls('/^[a-z]{0,9}$/', 'n'));

$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
$expected = array('a_z_0_9' => '/^[a-z]{0,9}$/');
$this->assertEquals($expected, $result);
}

/**
* Test that skipping fields during rule choice works when doing interactive field validation.
*
* @return void
*/
public function testSkippingChoiceInteractiveFieldValidation() {
$this->markTestIncomplete('Not done here yet');
$this->Task->initValidations();
$this->Task->interactive = true;
$this->Task->expects($this->any())->method('in')
->will($this->onConsecutiveCalls('24', 'y', 's'));

$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
$expected = array('notEmpty' => 'notEmpty', '_skipFields' => true);
$this->assertEquals($expected, $result);
}

/**
* Test that skipping fields after rule choice works when doing interactive field validation.
*
* @return void
*/
public function testSkippingAnotherInteractiveFieldValidation() {
$this->markTestIncomplete('Not done here yet');
$this->Task->initValidations();
$this->Task->interactive = true;
$this->Task->expects($this->any())->method('in')
->will($this->onConsecutiveCalls('24', 's'));

$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
$expected = array('notEmpty' => 'notEmpty', '_skipFields' => true);
$this->assertEquals($expected, $result);
}

/**
* Test the validation generation routine with skipping the rest of the fields
* when doing interactive field validation.
*
* @return void
*/
public function testInteractiveDoValidationWithSkipping() {
$this->markTestIncomplete('Not done here yet');
$this->Task->expects($this->any())
->method('in')
->will($this->onConsecutiveCalls('35', '24', 'n', '11', 's'));
$this->Task->interactive = true;
$Model = $this->getMock('Model');
$Model->primaryKey = 'id';
$Model->expects($this->any())
->method('schema')
->will($this->returnValue(array(
'id' => array(
'type' => 'integer',
'length' => 11,
'null' => false,
'key' => 'primary',
),
'name' => array(
'type' => 'string',
'length' => 20,
'null' => false,
),
'email' => array(
'type' => 'string',
'length' => 255,
'null' => false,
),
'some_date' => array(
'type' => 'date',
'length' => '',
'null' => false,
),
'some_time' => array(
'type' => 'time',
'length' => '',
'null' => false,
),
'created' => array(
'type' => 'datetime',
'length' => '',
'null' => false,
)
)
));

$result = $this->Task->doValidation($Model);
$expected = array(
'name' => array(
'notEmpty' => 'notEmpty'
),
'email' => array(
'email' => 'email',
),
);
$this->assertEquals($expected, $result);
}

/**
* test the validation Generation routine
*
* @return void
*/
public function testNonInteractiveDoValidation() {
$this->markTestIncomplete('Not done here yet');
$Model = $this->getMock('Model');
$Model->primaryKey = 'id';
$Model->expects($this->any())
->method('schema')
->will($this->returnValue(array(
'id' => array(
'type' => 'integer',
'length' => 11,
'null' => false,
'key' => 'primary',
),
'name' => array(
'type' => 'string',
'length' => 20,
'null' => false,
),
'email' => array(
'type' => 'string',
'length' => 255,
'null' => false,
),
'some_date' => array(
'type' => 'date',
'length' => '',
'null' => false,
),
'some_time' => array(
'type' => 'time',
'length' => '',
'null' => false,
),
'created' => array(
'type' => 'datetime',
'length' => '',
'null' => false,
)
)
));
$this->Task->interactive = false;

$result = $this->Task->doValidation($Model);
$expected = array(
'name' => array(
'notEmpty' => 'notEmpty'
),
'email' => array(
'email' => 'email',
),
'some_date' => array(
'date' => 'date'
),
'some_time' => array(
'time' => 'time'
),
);
$this->assertEquals($expected, $result);
}

/**
* test non interactive doAssociations
*
* @return void
*/
public function testDoAssociationsNonInteractive() {
$this->markTestIncomplete('Not done here yet');
$this->Task->connection = 'test';
$this->Task->interactive = false;
$model = new Model(array('ds' => 'test', 'name' => 'BakeArticle'));
$result = $this->Task->doAssociations($model);
$expected = array(
'belongsTo' => array(
array(
'alias' => 'BakeUser',
'className' => 'BakeUser',
'foreignKey' => 'bake_user_id',
),
),
'hasMany' => array(
array(
'alias' => 'BakeComment',
'className' => 'BakeComment',
'foreignKey' => 'bake_article_id',
),
),
'hasAndBelongsToMany' => array(
array(
'alias' => 'BakeTag',
'className' => 'BakeTag',
'foreignKey' => 'bake_article_id',
'joinTable' => 'bake_articles_bake_tags',
'associationForeignKey' => 'bake_tag_id',
),
),
);
$this->assertEquals($expected, $result);
}

/**
* test non interactive doActsAs
*
Expand Down

0 comments on commit 7b096f0

Please sign in to comment.