Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix coding standards
  • Loading branch information
ceeram committed Mar 18, 2013
1 parent 83de70e commit 89100f9
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 34 deletions.
14 changes: 7 additions & 7 deletions lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php
Expand Up @@ -437,7 +437,7 @@ public function insertCallback($table, $fields, $values) {
$this->insertMulti['fields'] = $fields;
$this->insertMulti['values'] = $values;
$this->insertMulti['fields_values'] = array();
foreach($values as $record) {
foreach ($values as $record) {
$this->insertMulti['fields_values'][] = array_combine($fields, $record);
}
return true;
Expand Down Expand Up @@ -467,18 +467,18 @@ public function testInsertStrings() {
$this->assertEquals($expected, $this->insertMulti['values']);
$expected = array(
array(
'name' => 'Mark Doe',
'email' => 'mark.doe@email.com',
'name' => 'Mark Doe',
'email' => 'mark.doe@email.com',
'age' => null
),
array(
'name' => 'John Doe',
'email' => 'john.doe@email.com',
'name' => 'John Doe',
'email' => 'john.doe@email.com',
'age' => 20
),
array(
'name' => 'Jane Doe',
'email' => 'jane.doe@email.com',
'name' => 'Jane Doe',
'email' => 'jane.doe@email.com',
'age' => 30
),
);
Expand Down
70 changes: 45 additions & 25 deletions lib/Cake/Test/Case/TestSuite/CakeTestSuiteDispatcherTest.php
@@ -1,38 +1,58 @@
<?php
/**
* CakeTestSuiteDispatcherTest file
*
* Test Case for CakeTestSuiteDispatcher class
*
* PHP version 5
*
* CakePHP : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP Project
* @package Cake.Test.Case.TestSuite
* @since CakePHP v 2.3.2
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

class CakeTestSuiteDispatcherTest extends CakeTestCase {

public function setUp() {
$this->vendors = App::path('vendors');
$this->includePath = ini_get('include_path');
}
public function setUp() {
$this->vendors = App::path('vendors');
$this->includePath = ini_get('include_path');
}

public function tearDown() {
App::build(array('Vendor' => $this->vendors), App::RESET);
ini_set('include_path', $this->includePath);
}
public function tearDown() {
App::build(array('Vendor' => $this->vendors), App::RESET);
ini_set('include_path', $this->includePath);
}

protected function clearPaths() {
App::build(array('Vendor' => array('junk')), App::RESET);
ini_set('include_path', 'junk');
}
protected function clearPaths() {
App::build(array('Vendor' => array('junk')), App::RESET);
ini_set('include_path', 'junk');
}

public function testLoadTestFramework() {
$dispatcher = new CakeTestSuiteDispatcher();
public function testLoadTestFramework() {
$dispatcher = new CakeTestSuiteDispatcher();

$this->assertTrue($dispatcher->loadTestFramework());
$this->assertTrue($dispatcher->loadTestFramework());

$this->clearPaths();
$this->clearPaths();

$exception = null;
$exception = null;

try {
$dispatcher->loadTestFramework();
} catch (Exception $ex) {
$exception = $ex;
}
try {
$dispatcher->loadTestFramework();
} catch (Exception $ex) {
$exception = $ex;
}

$this->assertEquals(get_class($exception), "PHPUnit_Framework_Error_Warning");
}
$this->assertEquals(get_class($exception), "PHPUnit_Framework_Error_Warning");
}

}
}
4 changes: 2 additions & 2 deletions lib/Cake/TestSuite/CakeTestSuiteDispatcher.php
Expand Up @@ -138,14 +138,14 @@ protected function _checkPHPUnit() {
*/
public function loadTestFramework() {
foreach (App::path('vendors') as $vendor) {
$vendor = rtrim($vendor, DS);
$vendor = rtrim($vendor, DS);
if (is_dir($vendor . DS . 'PHPUnit')) {
ini_set('include_path', $vendor . PATH_SEPARATOR . ini_get('include_path'));
break;
}
}

return (include('PHPUnit' . DS . 'Autoload.php')) !== false;
return (include ('PHPUnit' . DS . 'Autoload.php')) !== false;
}

/**
Expand Down

0 comments on commit 89100f9

Please sign in to comment.