Skip to content

Commit

Permalink
Tabs to spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
AidasK committed May 2, 2013
1 parent 089e9c8 commit 7495d0f
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 94 deletions.
34 changes: 17 additions & 17 deletions tests/config/test.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?php
return array(
'basePath'=>dirname(__FILE__).'/..',
'extensionPath'=>dirname(__FILE__).'/../..',
'basePath'=>dirname(__FILE__).'/..',
'extensionPath'=>dirname(__FILE__).'/../..',

'import'=>array(
'application.models.*',
),
'import'=>array(
'application.models.*',
),

'components'=>array(
'fixture'=>array(
'class'=>'system.test.CDbFixtureManager',
'basePath'=>dirname(__FILE__).'/../fixtures',
),
'db'=>array(
'connectionString'=>'mysql:host=localhost;dbname=test',
'username'=>'root',
'password'=>'',
'charset'=>'utf8',
),
),
'components'=>array(
'fixture'=>array(
'class'=>'system.test.CDbFixtureManager',
'basePath'=>dirname(__FILE__).'/../fixtures',
),
'db'=>array(
'connectionString'=>'mysql:host=localhost;dbname=test',
'username'=>'root',
'password'=>'',
'charset'=>'utf8',
),
),
);
8 changes: 4 additions & 4 deletions tests/fixtures/Folder.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
return array(
array(
'id'=>1,
'name'=>'folder 1',
),
array(
'id'=>1,
'name'=>'folder 1',
),
array(
'id'=>2,
'name'=>'Folder 1.2',
Expand Down
36 changes: 18 additions & 18 deletions tests/models/Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,24 @@ class Folder extends CActiveRecord
* @return Folder
*/
public static function model($className=__CLASS__)
{
return parent::model($className);
}
{
return parent::model($className);
}

public function behaviors()
{
return array(
'tree'=>array(
'class'=>'ext.ClosureTableBehavior',
'closureTableName'=>'folder_tree',
),
);
}
public function behaviors()
{
return array(
'tree'=>array(
'class'=>'ext.ClosureTableBehavior',
'closureTableName'=>'folder_tree',
),
);
}

public function rules()
{
return array(
array('name','required'),
);
}
public function rules()
{
return array(
array('name','required'),
);
}
}
10 changes: 5 additions & 5 deletions tests/phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<phpunit bootstrap="bootstrap.php"
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false">
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false">
</phpunit>
100 changes: 50 additions & 50 deletions tests/unit/ClosureTableBehaviorTest.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
<?php
class ClosureTableBehaviorTest extends CDbTestCase
{
public $fixtures=array(
'Folder',
public $fixtures=array(
'Folder',
'folder_tree' => ':folder_tree',
);
);

public function testDescendants()
{
public function testDescendants()
{
$folder = Folder::model()->findByPk(1);
$this->assertTrue($folder instanceof Folder);
$descendants = $folder->descendants()->findAll();
$this->assertEquals(6, count($descendants));
foreach($descendants as $descendant) {
$this->assertTrue($descendant instanceof Folder);
$this->assertTrue($folder instanceof Folder);
$descendants = $folder->descendants()->findAll();
$this->assertEquals(6, count($descendants));
foreach($descendants as $descendant) {
$this->assertTrue($descendant instanceof Folder);
}
$this->assertEquals(2, $descendants[0]->primaryKey);
$this->assertEquals(3, $descendants[1]->primaryKey);
$this->assertEquals(4, $descendants[2]->primaryKey);
$this->assertEquals(5, $descendants[3]->primaryKey);
$this->assertEquals(6, $descendants[4]->primaryKey);
$this->assertEquals(7, $descendants[5]->primaryKey);
}
$this->assertEquals(2, $descendants[0]->primaryKey);
$this->assertEquals(3, $descendants[1]->primaryKey);
$this->assertEquals(4, $descendants[2]->primaryKey);
$this->assertEquals(5, $descendants[3]->primaryKey);
$this->assertEquals(6, $descendants[4]->primaryKey);
$this->assertEquals(7, $descendants[5]->primaryKey);
}

public function testDescendantsOf()
{
Expand All @@ -35,38 +35,38 @@ public function testDescendantsOf()
}
}

public function testChildren()
{
public function testChildren()
{
$children = Folder::model()->childrenOf(1)->findAll();
$this->assertEquals(2, count($children));
foreach($children as $child) {
$this->assertTrue($child instanceof Folder);
$this->assertEquals(2, count($children));
foreach($children as $child) {
$this->assertTrue($child instanceof Folder);
}
$this->assertEquals(2, $children[0]->primaryKey);
$this->assertEquals(4, $children[1]->primaryKey);
}
$this->assertEquals(2, $children[0]->primaryKey);
$this->assertEquals(4, $children[1]->primaryKey);
}

public function testAncestors()
{
public function testAncestors()
{
$folder = Folder::model()->findByPk(6);
$this->assertTrue($folder instanceof Folder);
$ancestors = $folder->ancestors()->findAll();
$this->assertEquals(2, count($ancestors));
foreach($ancestors as $ancestor) {
$this->assertTrue($ancestor instanceof Folder);
$this->assertTrue($folder instanceof Folder);
$ancestors = $folder->ancestors()->findAll();
$this->assertEquals(2, count($ancestors));
foreach($ancestors as $ancestor) {
$this->assertTrue($ancestor instanceof Folder);
}
$this->assertEquals($ancestors[0]->primaryKey, 1);
$this->assertEquals($ancestors[1]->primaryKey, 4);
}

public function testParent()
{
$folder = Folder::model()->findByPk(6);
$this->assertTrue($folder instanceof Folder);
$parent = $folder->parent()->find();
$this->assertTrue($parent instanceof Folder);
$this->assertEquals($parent->primaryKey, 4);
}
$this->assertEquals($ancestors[0]->primaryKey, 1);
$this->assertEquals($ancestors[1]->primaryKey, 4);
}

public function testParent()
{
$folder = Folder::model()->findByPk(6);
$this->assertTrue($folder instanceof Folder);
$parent = $folder->parent()->find();
$this->assertTrue($parent instanceof Folder);
$this->assertEquals($parent->primaryKey, 4);
}

public function testPath()
{
Expand All @@ -82,8 +82,8 @@ public function testPath()
$this->assertEquals(7, $folders[3]->primaryKey);
}

public function testIsLeaf()
{
public function testIsLeaf()
{
$leafs = array(3,5,7);
$notLeafs = array(1,2,4,6);
foreach ($leafs as $id) {
Expand All @@ -96,10 +96,10 @@ public function testIsLeaf()
$this->assertTrue($folder instanceof Folder);
$this->assertFalse($folder->isLeaf());
};
}
}

public function testAppend()
{
public function testAppend()
{
$folder = Folder::model()->findByPk(5);
$newFolder = new Folder();
$newFolder->name = 'Folder 1.4.5.8';
Expand All @@ -114,7 +114,7 @@ public function testAppend()
$parent = $parent->parent()->find();
$this->assertTrue($parent instanceof Folder);
$this->assertEquals(1, $parent->primaryKey);
}
}

public function testMoveTo()
{
Expand Down

0 comments on commit 7495d0f

Please sign in to comment.