Skip to content

Commit

Permalink
Fix most code standards errors in Case/TestSuite.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Mar 18, 2012
1 parent fc234d8 commit 7798914
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 44 deletions.
35 changes: 18 additions & 17 deletions lib/Cake/Test/Case/TestSuite/CakeTestCaseTest.php
Expand Up @@ -256,7 +256,7 @@ public function testAssertTextEquals() {
$two = "\nOne\nTwo";
$this->assertTextEquals($one, $two);
}

/**
* test assertTextStartsWith()
*
Expand All @@ -265,7 +265,7 @@ public function testAssertTextEquals() {
public function testAssertTextStartsWith() {
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";

$this->assertStringStartsWith("some\nstring", $stringDirty);
$this->assertStringStartsNotWith("some\r\nstring\r\nwith", $stringDirty);
$this->assertStringStartsNotWith("some\nstring\nwith", $stringDirty);
Expand All @@ -282,19 +282,19 @@ public function testAssertTextStartsWith() {
public function testAssertTextStartsNotWith() {
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";

$this->assertTextStartsNotWith("some\nstring\nwithout", $stringDirty);
}

/**
* test assertTextEndsWith()
*
* @return void
*/
*/
public function testAssertTextEndsWith() {
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";

$this->assertTextEndsWith("string\nwith\r\ndifferent\rline endings!", $stringDirty);
$this->assertTextEndsWith("string\r\nwith\ndifferent\nline endings!", $stringDirty);
}
Expand All @@ -303,39 +303,40 @@ public function testAssertTextEndsWith() {
* test assertTextEndsNotWith()
*
* @return void
*/
*/
public function testAssertTextEndsNotWith() {
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";

$this->assertStringEndsNotWith("different\nline endings", $stringDirty);
$this->assertTextEndsNotWith("different\rline endings", $stringDirty);
}

/**
* test assertTextContains()
*
* @return void
*/
*/
public function testAssertTextContains() {
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";

$this->assertContains("different", $stringDirty);
$this->assertNotContains("different\rline", $stringDirty);
$this->assertTextContains("different\rline", $stringDirty);

$this->assertTextContains("different\rline", $stringDirty);
}

/**
* test assertTextNotContains()
*
* @return void
*/
*/
public function testAssertTextNotContains() {
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";
$this->assertTextNotContains("different\rlines", $stringDirty);

$this->assertTextNotContains("different\rlines", $stringDirty);
}

}
13 changes: 10 additions & 3 deletions lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php
Expand Up @@ -155,15 +155,23 @@ class CakeTestFixtureDefaultImportFixture extends CakeTestFixture {
* @package Cake.Test.Case.TestSuite
*/
class FixtureImportTestModel extends Model {

public $name = 'FixtureImport';

public $useTable = 'fixture_tests';

public $useDbConfig = 'test';

}

class FixturePrefixTest extends Model {

public $name = 'FixturePrefix';

public $useTable = '_tests';

public $tablePrefix = 'fixture';

public $useDbConfig = 'test';
}

Expand Down Expand Up @@ -218,9 +226,9 @@ public function testInit() {
$this->assertEquals($Fixture->primaryKey, 'my_random_key');
}


/**
* test that init() correctly sets the fixture table when the connection or model have prefixes defined.
* test that init() correctly sets the fixture table when the connection
* or model have prefixes defined.
*
* @return void
*/
Expand Down Expand Up @@ -359,7 +367,6 @@ public function testImportWithRecords() {
$Source->create($newTestSuiteDb);
$Source->insert($newTestSuiteDb);


$Fixture = new CakeTestFixtureDefaultImportFixture();
$Fixture->fields = $Fixture->records = null;
$Fixture->import = array(
Expand Down
18 changes: 0 additions & 18 deletions lib/Cake/Test/Case/TestSuite/CakeTestSuiteTest.php
Expand Up @@ -20,24 +20,6 @@
*/
class CakeTestSuiteTest extends CakeTestCase {

/**
* setUp
*
* @return void
*/
public function setUp() {
parent::setUp();
}

/**
* tearDown
*
* @return void
*/
public function tearDown() {
parent::tearDown();
}

/**
* testAddTestDirectory
*
Expand Down
10 changes: 6 additions & 4 deletions lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php
Expand Up @@ -26,7 +26,6 @@

require_once dirname(dirname(__FILE__)) . DS . 'Model' . DS . 'models.php';


/**
* AppController class
*
Expand All @@ -36,30 +35,34 @@
/**
* AppController class
*
* @package Cake.Test.Case.TestSuite
* @package Cake.Test.Case.TestSuite
*/
class AppController extends Controller {

/**
* helpers property
*
* @var array
* @access public
*/
public $helpers = array('Html');

/**
* uses property
*
* @var array
* @access public
*/
public $uses = array('ControllerPost');

/**
* components property
*
* @var array
* @access public
*/
public $components = array('Cookie');

}
} elseif (!defined('APP_CONTROLLER_EXISTS')) {
define('APP_CONTROLLER_EXISTS', true);
Expand Down Expand Up @@ -238,7 +241,6 @@ public function testGenerateWithPlugin() {
->will($this->returnValue(false));
$this->assertTrue($Tests->TestPluginComment->save(array()));
$this->assertFalse($Tests->TestPluginComment->save(array()));

}

/**
Expand Down Expand Up @@ -496,7 +498,7 @@ public function testNoControllerReuse() {
$this->assertContains('This is the TestsAppsController index view', $result);
$this->assertContains('first call', $result);
$this->assertContains('</html>', $result);

$result = $this->Case->testAction('/tests_apps/index', array(
'data' => array('var' => 'second call'),
'method' => 'get',
Expand Down
3 changes: 1 addition & 2 deletions lib/Cake/Test/Case/TestSuite/HtmlCoverageReportTest.php
Expand Up @@ -21,6 +21,7 @@
App::uses('CakeBaseReporter', 'TestSuite/Reporter');

class HtmlCoverageReportTest extends CakeTestCase {

/**
* setUp
*
Expand Down Expand Up @@ -127,7 +128,6 @@ public function testGenerateDiff() {
}
}


/**
* Test that coverage works with phpunit 3.6 as the data formats from coverage are totally different.
*
Expand Down Expand Up @@ -198,7 +198,6 @@ public function testCoveredLinesTitleAttributes() {
5 => -1
);


$result = $this->Coverage->generateDiff('myfile.php', $file, $coverage);

$this->assertTrue(
Expand Down

0 comments on commit 7798914

Please sign in to comment.