code:
<?php

require_once 'ModelMock.php';

/**
 * CDateValidatorTest
 *
 * @author   Kevin Bradwick <kbradwick@gmail.com>
 */
class CDateValidatorTest extends CTestCase
{
    /**
     * Test allow empty
     *
     * @return null
     */
    public function testAllowEmptyOption()
    {
        $model = $this->getModelMock(array('allowEmpty' => true));
        $this->assertTrue($model->validate());

        $model = $this->getModelMock(array('allowEmpty' => false));
        $this->assertFalse($model->validate());
        $this->assertTrue($model->hasErrors('foo'));
    }

    /**
     * Test can validate different formats
     *
     * @return null
     */
    public function testFormatOption()
    {
        // default format
        $model = $this->getModelMock();
        $model->foo = '01/01/2011';
        $this->assertTrue($model->validate());
        $model->foo = '42/01/2011';
        $this->assertFalse($model->validate());

        // custom format
        $model = $this->getModelMock(array('format' => 'dd-MM-yyyy'));
        $model->foo = '01-01-2011';
        $this->assertTrue($model->validate());
        $model->foo = '01-24-2011';
        $this->assertFalse($model->validate());
    }

    /**
     * Test the timestamp option
     *
     * @return null
     */
    public function testTimestampOption()
    {
        $model = $this->getModelMock(array('timestampAttribute' => 'bar'));
        $model->foo = '01/01/2011';
        $this->assertTrue($model->validate());
        $this->assertInternalType('integer', $model->bar);
        $this->assertEquals(strtotime('1 Jan 2011'), $model->bar);
    }

    /**
     * Mocks up an object to test with
     *
     * @param array $operator optional parameters to configure rule
     *
     * @return null
     */
    protected function getModelMock($params=array())
    {
        $rules = array(
            array('foo', 'date')
        );

        foreach ($params as $rule => $value) {
            $rules[0][$rule] = $value;
        }

        $stub = $this->getMock('ModelMock', array('rules'));
        $stub->expects($this->any())
             ->method('rules')
             ->will($this->returnValue($rules));

        return $stub;
    }
}


code:
<?php

require_once 'ModelMock.php';

/**
 * CDateValidatorTest
 *
 * @author   Kevin Bradwick <kbradwick@gmail.com>
 */
class CDefaultValueValidatorTest extends CTestCase
{
    /**
     * When value is empty|null, ensure a default value is set
     *
     * @return null
     */
    public function testDefaultValueIsSetWhenSetOnEmptyIsTrue()
    {
        $model = $this->getModelMock(array('value' => 'foo'));
        $this->assertTrue($model->validate());
        $this->assertEquals('foo', $model->foo);

        $model->foo = 'bar';
        $this->assertTrue($model->validate());
        $this->assertEquals('bar', $model->foo);

    }

    /**
     * By setting setOnEmpty to false, the value will always be overriden
     *
     * @return null
     */
    public function testDefaultValueIsSetWhenSetOnEmptyIsFalse()
    {
        $model = $this->getModelMock(array('value' => 'foo', 'setOnEmpty' => false));
        $model->foo = 'bar';
        $this->assertTrue($model->validate());
        $this->assertEquals('foo', $model->foo);
    }

    /**
     * Mocks up an object to test with
     *
     * @param array $operator optional parameters to configure rule
     *
     * @return null
     */
    protected function getModelMock($params=array())
    {
        $rules = array(
            array('foo', 'default')
        );

        foreach ($params as $rule => $value) {
            $rules[0][$rule] = $value;
        }

        $stub = $this->getMock('ModelMock', array('rules'));
        $stub->expects($this->any())
             ->method('rules')
             ->will($this->returnValue($rules));

        return $stub;
    }
}

repo_name: DaSourcerer/yii

license: mit


code:
<?php
require 'ValidatorTestModel.php';

class CEmailValidatorTest extends CTestCase
{
	public function testEmpty()
	{
		$model = new ValidatorTestModel();
		$model->validate(array('email'));
		$this->assertArrayHasKey('email', $model->getErrors());
	}

	public function testNumericEmail()
	{
		$emailValidator = new CEmailValidator();
		$result = $emailValidator->validateValue("5011@gmail.com");
		$this->assertTrue($result);
	}
}


code:
<?php

require_once 'ModelMock.php';

class CValidatorTest extends CTestCase
{
    public function test()
    {

    }
}


code:
<?php

class ModelMock extends CFormModel
{
    public $foo;

    public $bar;
}


code:
<?php
class ValidatorTestModel extends CFormModel
{
	public $email;

	public function rules()
	{
		return array(
			array('email', 'email', 'allowEmpty' => false),
		);
	}
}


code:
<?php

Yii::import('system.web.CAssetManager');

class CAssetManagerTest extends CTestCase
{
	public function testBasePath()
	{
		$am2=new CAssetManager;
		$app=new TestApplication;
		$app->reset();
		$am2->init($app);
		$this->assertEquals($am2->basePath,$app->basePath.DIRECTORY_SEPARATOR.'assets');
	}

	public function testBaseUrl()
	{
		$app=new TestApplication;
		$app->request->baseUrl='/test';
		$am=new CAssetManager;
		$am->init($app);
		$this->assertEquals($am->baseUrl,'/test/assets');
	}

	public function testPublishFile()
	{
		$app=new TestApplication;
		$app->reset();
		$am=new CAssetManager;
		$am->init($app);
		$path1=$am->getPublishedPath(__FILE__);
		clearstatcache();
		$this->assertFalse(is_file($path1));
		$url=$am->publish(__FILE__);
		$path2=$am->getPublishedPath(__FILE__);
		$this->assertEquals($path1,$path2);
		clearstatcache();
		$this->assertTrue(is_file($path1));
		$this->assertEquals(basename($path1),basename(__FILE__));
		$this->assertEquals($url,$am->baseUrl.'/'.basename(dirname($path2)).'/'.basename($path2));
	}
}


code:
<?php

Yii::import('system.web.CController');
Yii::import('system.web.filters.CFilter');
Yii::import('system.web.actions.CAction');

class TestController extends CController
{
	public $defaultAction='external';
	public $internal=0;
	public $external=0;
	public $internalFilter1=0;
	public $internalFilter2=0;
	public $internalFilter3=0;
	public $externalFilter=0;

	public function filters()
	{
		return array(
			'filter1',
			'filter2 + internal',
			array(
				'TestFilter',
				'expire'=>300,
			),
			'filter3 - internal',
		);
	}

	public function actions()
	{
		return array(
			'external'=>'TestAction',
		);
	}

	public function missingAction($actionName)
	{
		throw new CException('test missing');
	}

	public function filterFilter1($chain)
	{
		$chain->run();
		$this->internalFilter1++;
	}

	public function filterFilter2($chain)
	{
		$this->internalFilter2++;
		$chain->run();
	}

	public function filterFilter3($chain)
	{
		$this->internalFilter3++;
		$chain->run();
	}

	public function actionInternal()
	{
		$this->internal++;
	}

	public $a;
	public $b;
	public $c;
	public $d;

	public function actionCreate($a,$b,$c=3,$d=4)
	{
		$this->a=$a;
		$this->b=$b;
		$this->c=$c;
		$this->d=$d;
	}
}

class TestFilter extends CFilter
{
	public $expire=0;
	public function filter($chain)
	{
		if($chain->controller->externalFilter<=1)
		{
			$chain->controller->externalFilter++;
			$chain->run();
		}
	}
}

class TestAction extends CAction
{
	public function run()
	{
		$this->controller->external++;
	}
}

class CControllerTest extends CTestCase
{
	public function testDefaultProperties()
	{
		$app=new TestApplication;
		$_SERVER['REQUEST_METHOD']='GET';
		$c=new CController('test/subtest');
		$this->assertEquals($c->id,'test/subtest');
		$this->assertEquals($c->filters(),array());
		$this->assertEquals($c->actions(),array());
		$this->assertNull($c->action);
		$this->assertEquals($c->defaultAction,'index');
		$this->assertEquals($c->viewPath,$app->viewPath.DIRECTORY_SEPARATOR.'test/subtest');
		$this->setExpectedException('CHttpException');
		$c->missingAction('index');
	}

	public function testRunAction()
	{
		$app=new TestApplication;
		$c=new TestController('test');
		$this->assertEquals($c->internal,0);
		$this->assertEquals($c->external,0);
		$this->assertEquals($c->internalFilter1,0);
		$this->assertEquals($c->internalFilter2,0);
		$this->assertEquals($c->internalFilter3,0);
		$this->assertEquals($c->externalFilter,0);

		$c->run('');
		$this->assertEquals($c->internal,0);
		$this->assertEquals($c->external,1);
		$this->assertEquals($c->internalFilter1,1);
		$this->assertEquals($c->internalFilter2,0);
		$this->assertEquals($c->internalFilter3,1);
		$this->assertEquals($c->externalFilter,1);

		$c->run('internal');
		$this->assertEquals($c->internal,1);
		$this->assertEquals($c->external,1);
		$this->assertEquals($c->internalFilter1,2);
		$this->assertEquals($c->internalFilter2,1);
		$this->assertEquals($c->internalFilter3,1);
		$this->assertEquals($c->externalFilter,2);

		$c->run('external');
		$this->assertEquals($c->internal,1);
		$this->assertEquals($c->external,1);
		$this->assertEquals($c->internalFilter1,3);
		$this->assertEquals($c->internalFilter2,1);
		$this->assertEquals($c->internalFilter3,1);
		$this->assertEquals($c->externalFilter,2);

		$this->setExpectedException('CException');
		$c->run('unknown');
	}

	public function testActionParams()
	{
		$app=new TestApplication;
		$c=new TestController('test');

		$_GET['a']=1;
		$_GET['b']='2';
		$c->run('create');
		$this->assertTrue($c->a===1);
		$this->assertTrue($c->b==='2');
		$this->assertTrue($c->c===3);
		$this->assertTrue($c->d===4);

		$_GET['a']=11;
		$_GET['b']='22';
		$_GET['d']='44';
		$c->run('create');
		$this->assertTrue($c->a===11);
		$this->assertTrue($c->b==='22');
		$this->assertTrue($c->c===3);
		$this->assertTrue($c->d==='44');
	}

	public function testActionParamsInvalid()
	{
		$app=new TestApplication;
		$c=new TestController('test');
		$_GET=array('a'=>1);
		$this->setExpectedException('CException');
		$c->run('create');
	}
}


code:
<?php
/**
 * CSortTest
 */

Yii::import('system.db.CDbConnection');
Yii::import('system.db.ar.CActiveRecord');

class CSortTest extends CTestCase {
	private $db;

	public function setUp(){
		if(!extension_loaded('pdo') || !extension_loaded('pdo_sqlite'))
			$this->markTestSkipped('PDO and SQLite extensions are required.');

		$this->db=new CDbConnection('sqlite::memory:');
		$this->db->active=true;
		$this->db->pdoInstance->exec(file_get_contents(dirname(__FILE__).'/CSortTest.sql'));
		CActiveRecord::$db=$this->db;
	}

	public function tearDown(){
		$this->db->active=false;
	}

	/**
	 * Tests for acceptance of fields with dots in
	 * CSort::attributes.
	 *
	 * @return void
	 */
	function testGetDirectionsWithDots(){
		$_GET['sort'] = 'comments.id';

		$criteria = new CDbCriteria();
		$criteria->with = 'comments';

		$sort = new CSort('TestPost');
		$sort->attributes = array(
			'id',
			'comments.id' => array(
			  'asc'=>'comments.id',
			  'desc'=>'comments.id desc',
			),
		);
		$sort->applyOrder($criteria);
		$directions = $sort->getDirections();

		$this->assertTrue(isset($directions['comments.id']));
	}
}

class TestPost extends CActiveRecord {
	public static function model($className=__CLASS__) {
        return parent::model($className);
    }

	public function tableName() {
        return 'post';
    }

	public function relations() {
        return array(
           'comments'=>array(self::HAS_MANY, 'TestComment', 'post_id'),
        );
    }
}

class TestComment extends CActiveRecord {
	public static function model($className=__CLASS__) {
        return parent::model($className);
    }

	public function tableName() {
        return 'comment';
    }

	public function relations() {
        return array(
           'post'=>array(self::BELONGS_TO, 'TestPost', 'post_id'),
        );
    }
}


code:
CREATE TABLE comment (
  id INTEGER PRIMARY KEY,
  post_id INTEGER,
  text text,
  created_at INTEGER
);

CREATE TABLE post (
  id INTEGER PRIMARY KEY,
  created_at INTEGER,
  title VARCHAR(255)
);


code:
<?php

Yii::import('system.web.CUrlManager');
Yii::import('system.web.CHttpRequest');

class TestHttpRequest extends CHttpRequest
{
	private $myPathInfo;
	private $myScriptUrl;

	public function getScriptUrl()
	{
		return $this->myScriptUrl;
	}

	public function setScriptUrl($value)
	{
		$this->myScriptUrl=$value;
	}

	public function getPathInfo()
	{
		return $this->myPathInfo;
	}

	public function setPathInfo($value)
	{
		$this->myPathInfo=$value;
	}
}

class CUrlManagerTest extends CTestCase
{
	public function testParseUrlWithPathFormat()
	{
		$rules=array(
			'article/<id:\d+>'=>'article/read',
			'article/<year:\d{4}>/<title>/*'=>'article/read',
			'a/<_a>/*'=>'article',
			'register/*'=>'user',
			'home/*'=>'',
			'ad/*'=>'admin/index/list',
			'<c:(post|comment)>/<id:\d+>/<a:(create|update|delete)>'=>'<c>/<a>',
			'<c:(post|comment)>/<id:\d+>'=>'<c>/view',
			'<c:(post|comment)>s/*'=>'<c>/list',
			'http://<user:\w+>.example.com/<lang:\w+>/profile'=>'user/profile',
		);
		$entries=array(
			array(
				'pathInfo'=>'article/123',
				'route'=>'article/read',
				'params'=>array('id'=>'123'),
			),
			array(
				'pathInfo'=>'article/123/name/value',
				'route'=>'article/123/name/value',
				'params'=>array(),
			),
			array(
				'pathInfo'=>'article/2000/title goes here',
				'route'=>'article/read',
				'params'=>array('year'=>'2000','title'=>'title goes here'),
			),
			array(
				'pathInfo'=>'article/2000/title goes here/name/value',
				'route'=>'article/read',
				'params'=>array('year'=>'2000','title'=>'title goes here','name'=>'value'),
			),
			array(
				'pathInfo'=>'register/username/admin',
				'route'=>'user',
				'params'=>array('username'=>'admin'),
			),
			array(
				'pathInfo'=>'home/name/value/name1/value1',
				'route'=>'',
				'params'=>array('name'=>'value','name1'=>'value1'),
			),
			array(
				'pathInfo'=>'home2/name/value/name1/value1',
				'route'=>'home2/name/value/name1/value1',
				'params'=>array(),
			),
			array(
				'pathInfo'=>'post',
				'route'=>'post',
				'params'=>array(),
			),
			array(
				'pathInfo'=>'post/read',
				'route'=>'post/read',
				'params'=>array(),
			),
			array(
				'pathInfo'=>'post/read/id/100',
				'route'=>'post/read/id/100',
				'params'=>array(),
			),
			array(
				'pathInfo'=>'',
				'route'=>'',
				'params'=>array(),
			),
			array(
				'pathInfo'=>'ad/name/value',
				'route'=>'admin/index/list',
				'params'=>array('name'=>'value'),
			),
			array(
				'pathInfo'=>'admin/name/value',
				'route'=>'admin/name/value',
				'params'=>array(),
			),
			array(
				'pathInfo'=>'posts',
				'route'=>'post/list',
				'params'=>array(),
			),
			array(
				'pathInfo'=>'posts/page/3',
				'route'=>'post/list',
				'params'=>array('page'=>3),
			),
			array(
				'pathInfo'=>'post/3',
				'route'=>'post/view',
				'params'=>array('id'=>3),
			),
			array(
				'pathInfo'=>'post/3/delete',
				'route'=>'post/delete',
				'params'=>array('id'=>3),
			),
			array(
				'pathInfo'=>'post/3/delete/a',
				'route'=>'post/3/delete/a',
				'params'=>array(),
			),
			array(
				'pathInfo'=>'en/profile',
				'route'=>'user/profile',
				'params'=>array('user'=>'admin','lang'=>'en'),
			),
		);
		$config=array(
			'basePath'=>dirname(__FILE__),
			'components'=>array(
				'request'=>array(
					'class'=>'TestHttpRequest',
					'scriptUrl'=>'/app/index.php',
				),
			),
		);
		$app=new TestApplication($config);
		$app->controllerPath=dirname(__FILE__).DIRECTORY_SEPARATOR.'controllers';
		$request=$app->request;
		$_SERVER['HTTP_HOST']='admin.example.com';
		$um=new CUrlManager;
		$um->urlSuffix='.html';
		$um->urlFormat='path';
		$um->rules=$rules;
		$um->init($app);
		foreach($entries as $entry)
		{
			$request->pathInfo=$entry['pathInfo'];
			$_GET=array();
			$route=$um->parseUrl($request);
			$this->assertEquals($entry['route'],$route);
			$this->assertEquals($entry['params'],$_GET);
			// test the .html version
			$request->pathInfo=$entry['pathInfo'].'.html';
			$_GET=array();
			$route=$um->parseUrl($request);
			$this->assertEquals($entry['route'],$route);
			$this->assertEquals($entry['params'],$_GET);
		}
	}

	public function testcreateUrlWithPathFormat()
	{
		$rules=array(
			'article/<id:\d+>'=>'article/read',
			'article/<year:\d{4}>/<title>/*'=>'article/read',
			'a/<_a>/*'=>'article',
			'register/*'=>'user',
			'home/*'=>'',
			'<c:(post|comment)>/<id:\d+>/<a:(create|update|delete)>'=>'<c>/<a>',
			'<c:(post|comment)>/<id:\d+>'=>'<c>/view',
			'<c:(post|comment)>s/*'=>'<c>/list',
			'http://<user:\w+>.example.com/<lang:\w+>/profile'=>'user/profile',
		);
		$config=array(
			'basePath'=>dirname(__FILE__),
			'components'=>array(
				'request'=>array(
					'class'=>'TestHttpRequest',
				),
			),
		);
		$_SERVER['HTTP_HOST']='user.example.com';
		$app=new TestApplication($config);
		$entries=array(
			array(
				'scriptUrl'=>'/apps/index.php',
				'url'=>'/apps/index.php/post/123?name1=value1',
				'url2'=>'/apps/post/123?name1=value1',
				'url3'=>'/apps/post/123.html?name1=value1',
				'route'=>'post/view',
				'params'=>array(
					'id'=>'123',
					'name1'=>'value1',
				),
			),
			array(
				'scriptUrl'=>'/apps/index.php',
				'url'=>'/apps/index.php/post/123/update?name1=value1',
				'url2'=>'/apps/post/123/update?name1=value1',
				'url3'=>'/apps/post/123/update.html?name1=value1',
				'route'=>'post/update',
				'params'=>array(
					'id'=>'123',
					'name1'=>'value1',
				),
			),
			array(
				'scriptUrl'=>'/apps/index.php',
				'url'=>'/apps/index.php/posts/page/123',
				'url2'=>'/apps/posts/page/123',
				'url3'=>'/apps/posts/page/123.html',
				'route'=>'post/list',
				'params'=>array(
					'page'=>'123',
				),
			),
			array(
				'scriptUrl'=>'/apps/index.php',
				'url'=>'/apps/index.php/article/123?name1=value1',
				'url2'=>'/apps/article/123?name1=value1',
				'url3'=>'/apps/article/123.html?name1=value1',
				'route'=>'article/read',
				'params'=>array(
					'id'=>'123',
					'name1'=>'value1',
				),
			),
			array(
				'scriptUrl'=>'/index.php',
				'url'=>'/index.php/article/123?name1=value1',
				'url2'=>'/article/123?name1=value1',
				'url3'=>'/article/123.html?name1=value1',
				'route'=>'article/read',
				'params'=>array(
					'id'=>'123',
					'name1'=>'value1',
				),
			),
			array(
				'scriptUrl'=>'/apps/index.php',
				'url'=>'/apps/index.php/article/2000/the_title/name1/value1',
				'url2'=>'/apps/article/2000/the_title/name1/value1',
				'url3'=>'/apps/article/2000/the_title/name1/value1.html',
				'route'=>'article/read',
				'params'=>array(
					'year'=>'2000',
					'title'=>'the_title',
					'name1'=>'value1',
				),
			),
			array(
				'scriptUrl'=>'/index.php',
				'url'=>'/index.php/article/2000/the_title/name1/value1',
				'url2'=>'/article/2000/the_title/name1/value1',
				'url3'=>'/article/2000/the_title/name1/value1.html',
				'route'=>'article/read',
				'params'=>array(
					'year'=>'2000',
					'title'=>'the_title',
					'name1'=>'value1',
				),
			),
			array(
				'scriptUrl'=>'/apps/index.php',
				'url'=>'/apps/index.php/post/edit/id/123/name1/value1',
				'url2'=>'/apps/post/edit/id/123/name1/value1',
				'url3'=>'/apps/post/edit/id/123/name1/value1.html',
				'route'=>'post/edit',
				'params'=>array(
					'id'=>'123',
					'name1'=>'value1',
				),
			),
			array(
				'scriptUrl'=>'/index.php',
				'url'=>'http://admin.example.com/en/profile',
				'url2'=>'http://admin.example.com/en/profile',
				'url3'=>'http://admin.example.com/en/profile.html',
				'route'=>'user/profile',
				'params'=>array(
					'user'=>'admin',
					'lang'=>'en',
				),
			),
			array(
				'scriptUrl'=>'/index.php',
				'url'=>'/en/profile',
				'url2'=>'/en/profile',
				'url3'=>'/en/profile.html',
				'route'=>'user/profile',
				'params'=>array(
					'user'=>'user',
					'lang'=>'en',
				),
			),
		);
		foreach($entries as $entry)
		{
			$app->request->baseUrl=null; // reset so that it can be determined based on scriptUrl
			$app->request->scriptUrl=$entry['scriptUrl'];
			$um=new CUrlManager;
			$um->urlFormat='path';
			$um->rules=$rules;
			$um->init($app);
			$url=$um->createUrl($entry['route'],$entry['params']);
			$this->assertEquals($entry['url'],$url);

			$um=new CUrlManager;
			$um->urlFormat='path';
			$um->rules=$rules;
			$um->init($app);
			$um->showScriptName=false;
			$url=$um->createUrl($entry['route'],$entry['params']);
			$this->assertEquals($entry['url2'],$url);

			$um->urlSuffix='.html';
			$url=$um->createUrl($entry['route'],$entry['params']);
			$this->assertEquals($entry['url3'],$url);
		}
	}

	public function testParseUrlWithGetFormat()
	{
		$config=array(
			'basePath'=>dirname(__FILE__),
			'components'=>array(
				'request'=>array(
					'class'=>'TestHttpRequest',
					'scriptUrl'=>'/app/index.php',
				),
			),
		);
		$entries=array(
			array(
				'route'=>'article/read',
				'name'=>'value',
			),
		);
		$app=new TestApplication($config);
		$request=$app->request;
		$um=new CUrlManager;
		$um->urlFormat='get';
		$um->routeVar='route';
		$um->init($app);
		foreach($entries as $entry)
		{
			$_GET=$entry;
			$route=$um->parseUrl($request);
			$this->assertEquals($entry['route'],$route);
			$this->assertEquals($_GET,$entry);
		}
	}

	public function testCreateUrlWithGetFormat()
	{
		$config=array(
			'basePath'=>dirname(__FILE__),
			'components'=>array(
				'request'=>array(
					'class'=>'TestHttpRequest',
				),
			),
		);
		$app=new TestApplication($config);
		$entries=array(
			array(
				'scriptUrl'=>'/apps/index.php',
				'url'=>'/apps/index.php?route=article/read&name=value&name1=value1',
				'url2'=>'/apps/?route=article/read&name=value&name1=value1',
				'route'=>'article/read',
				'params'=>array(
					'name'=>'value',
					'name1'=>'value1',
				),
			),
			array(
				'scriptUrl'=>'/index.php',
				'url'=>'/index.php?route=article/read&name=value&name1=value1',
				'url2'=>'/?route=article/read&name=value&name1=value1',
				'route'=>'article/read',
				'params'=>array(
					'name'=>'value',
					'name1'=>'value1',
				),
			),
		);
		foreach($entries as $entry)
		{
			$app->request->baseUrl=null;
			$app->request->scriptUrl=$entry['scriptUrl'];
			$um=new CUrlManager;
			$um->urlFormat='get';
			$um->routeVar='route';
			$um->init($app);
			$url=$um->createUrl($entry['route'],$entry['params'],'&');
			$this->assertEquals($url,$entry['url']);

			$um=new CUrlManager;
			$um->urlFormat='get';
			$um->routeVar='route';
			$um->showScriptName=false;
			$um->init($app);
			$url=$um->createUrl($entry['route'],$entry['params'],'&');
			$this->assertEquals($url,$entry['url2']);
		}
	}

	public function testDefaultParams()
	{
		$config=array(
			'basePath'=>dirname(__FILE__),
			'components'=>array(
				'request'=>array(
					'class'=>'TestHttpRequest',
				),
			),
		);
		$app=new TestApplication($config);

		$app->request->baseUrl=null; // reset so that it can be determined based on scriptUrl
		$app->request->scriptUrl='/apps/index.php';
		$um=new CUrlManager;
		$um->urlFormat='path';
		$um->rules=array(
			''=>array('site/page', 'defaultParams'=>array('view'=>'about')),
			'posts'=>array('post/index', 'defaultParams'=>array('page'=>1)),
			'<slug:[0-9a-z-]+>' => array('news/list', 'defaultParams' => array('page' => 1)),
		);
		$um->init($app);

		$url=$um->createUrl('site/page',array('view'=>'about'));
		$this->assertEquals('/apps/index.php/',$url);
		$app->request->pathInfo='';
		$_GET=array();
		$route=$um->parseUrl($app->request);
		$this->assertEquals('site/page',$route);
		$this->assertEquals(array('view'=>'about'),$_GET);

		$url=$um->createUrl('post/index',array('page'=>1));
		$this->assertEquals('/apps/index.php/posts',$url);
		$app->request->pathInfo='posts';
		$_GET=array();
		$route=$um->parseUrl($app->request);
		$this->assertEquals('post/index',$route);
		$this->assertEquals(array('page'=>'1'),$_GET);

		$url=$um->createUrl('news/list', array('slug' => 'example', 'page' => 1));
		$this->assertEquals('/apps/index.php/example',$url);
		$app->request->pathInfo='example';
		$_GET=array();
		$route=$um->parseUrl($app->request);
		$this->assertEquals('news/list',$route);
		$this->assertEquals(array('slug'=>'example', 'page'=>'1'),$_GET);
	}

	public function testVerb()
	{
		$config=array(
			'basePath'=>dirname(__FILE__),
			'components'=>array(
				'request'=>array(
					'class'=>'TestHttpRequest',
				),
			),
		);
		$rules=array(
			'article/<id:\d+>'=>array('article/read', 'verb'=>'GET'),
			'article/update/<id:\d+>'=>array('article/update', 'verb'=>'POST'),
			'article/update/*'=>'article/admin',
		);

		$entries=array(
			array(
				'scriptUrl'=>'/apps/index.php',
				'url'=>'article/123',
				'verb'=>'GET',
				'route'=>'article/read',
			),
			array(
				'scriptUrl'=>'/apps/index.php',
				'url'=>'article/update/123',
				'verb'=>'POST',
				'route'=>'article/update',
			),
			array(
				'scriptUrl'=>'/apps/index.php',
				'url'=>'article/update/123',
				'verb'=>'GET',
				'route'=>'article/admin',
			),
		);

		foreach($entries as $entry)
		{
			$_SERVER['REQUEST_METHOD']=$entry['verb'];
			$app=new TestApplication($config);
			$app->request->baseUrl=null; // reset so that it can be determined based on scriptUrl
			$app->request->scriptUrl=$entry['scriptUrl'];
			$app->request->pathInfo=$entry['url'];
			$um=new CUrlManager;
			$um->urlFormat='path';
			$um->rules=$rules;
			$um->init($app);
			$route=$um->parseUrl($app->request);
			$this->assertEquals($entry['route'],$route);
		}
	}

	public function testParsingOnly()
	{
		$config=array(
			'basePath'=>dirname(__FILE__),
			'components'=>array(
				'request'=>array(
					'class'=>'TestHttpRequest',
				),
			),
		);
		$rules=array(
			'(articles|article)/<id:\d+>'=>array('article/read', 'parsingOnly'=>true),
			'article/<id:\d+>'=>array('article/read', 'verb'=>'GET'),
		);

		$_SERVER['REQUEST_METHOD']='GET';
		$app=new TestApplication($config);
		$app->request->baseUrl=null; // reset so that it can be determined based on scriptUrl
		$app->request->scriptUrl='/apps/index.php';
		$app->request->pathInfo='articles/123';
		$um=new CUrlManager;
		$um->urlFormat='path';
		$um->rules=$rules;
		$um->init($app);

		$route=$um->parseUrl($app->request);
		$this->assertEquals('article/read',$route);

		$url=$um->createUrl('article/read', array('id'=>345));
		$this->assertEquals('/apps/index.php/article/345',$url);
	}
}


code:
<?php

abstract class AuthManagerTestBase extends CTestCase
{
	protected $auth;

	public function testcreateAuthItem()
	{
		$type=CAuthItem::TYPE_TASK;
		$name='editUser';
		$description='edit a user';
		$bizRule='checkUserIdentity()';
		$data=array(1,2,3);
		$item=$this->auth->createAuthItem($name,$type,$description,$bizRule,$data);
		$this->assertTrue($item instanceof CAuthItem);
		$this->assertEquals($item->type,$type);
		$this->assertEquals($item->name,$name);
		$this->assertEquals($item->description,$description);
		$this->assertEquals($item->bizRule,$bizRule);
		$this->assertEquals($item->data,$data);

		// test shortcut
		$name2='createUser';
		$item2=$this->auth->createRole($name2,$description,$bizRule,$data);
		$this->assertEquals($item2->type,CAuthItem::TYPE_ROLE);

		// test adding an item with the same name
		$this->setExpectedException('CException');
		$this->auth->createAuthItem($name,$type,$description,$bizRule,$data);
	}

	public function testGetAuthItem()
	{
		$this->assertTrue($this->auth->getAuthItem('readPost') instanceof CAuthItem);
		$this->assertTrue($this->auth->getAuthItem('reader') instanceof CAuthItem);
		$this->assertNull($this->auth->getAuthItem('unknown'));
	}

	public function testRemoveAuthItem()
	{
		$this->assertTrue($this->auth->getAuthItem('updatePost') instanceof CAuthItem);
		$this->assertTrue($this->auth->removeAuthItem('updatePost'));
		$this->assertNull($this->auth->getAuthItem('updatePost'));
		$this->assertFalse($this->auth->removeAuthItem('updatePost'));
	}

	public function testChangeItemName()
	{
		$item=$this->auth->getAuthItem('readPost');
		$this->assertTrue($item instanceof CAuthItem);
		$this->assertTrue($this->auth->hasItemChild('reader','readPost'));
		$item->name='readPost2';
		$this->assertNull($this->auth->getAuthItem('readPost'));
		$this->assertEquals($this->auth->getAuthItem('readPost2'),$item);
		$this->assertFalse($this->auth->hasItemChild('reader','readPost'));
		$this->assertTrue($this->auth->hasItemChild('reader','readPost2'));
	}

	public function testAddItemChild()
	{
		$this->auth->addItemChild('createPost','updatePost');

		// test adding upper level item to lower one
		$this->setExpectedException('CException');
		$this->auth->addItemChild('readPost','reader');
	}

	public function testAddItemChild2()
	{
		// test adding inexistent items
		$this->setExpectedException('CException');
		$this->assertFalse($this->auth->addItemChild('createPost2','updatePost'));
	}

	public function testRemoveItemChild()
	{
		$this->assertTrue($this->auth->hasItemChild('reader','readPost'));
		$this->assertTrue($this->auth->removeItemChild('reader','readPost'));
		$this->assertFalse($this->auth->hasItemChild('reader','readPost'));
		$this->assertFalse($this->auth->removeItemChild('reader','readPost'));
	}

	public function testGetItemChildren()
	{
		$this->assertEquals(array(),$this->auth->getItemChildren('readPost'));
		$children=$this->auth->getItemChildren('author');
		$this->assertEquals(3,count($children));
		$this->assertTrue(reset($children) instanceof CAuthItem);
	}

	public function testAssign()
	{
		$auth=$this->auth->assign('createPost','new user','rule','data');
		$this->assertTrue($auth instanceof CAuthAssignment);
		$this->assertEquals($auth->userId,'new user');
		$this->assertEquals($auth->itemName,'createPost');
		$this->assertEquals($auth->bizRule,'rule');
		$this->assertEquals($auth->data,'data');

		$this->setExpectedException('CException');
		$this->auth->assign('createPost2','new user','rule','data');
	}

	public function testRevoke()
	{
		$this->assertTrue($this->auth->isAssigned('author','author B'));
		$auth=$this->auth->getAuthAssignment('author','author B');
		$this->assertTrue($auth instanceof CAuthAssignment);
		$this->assertTrue($this->auth->revoke('author','author B'));
		$this->assertFalse($this->auth->isAssigned('author','author B'));
		$this->assertFalse($this->auth->revoke('author','author B'));
	}

	public function testGetAuthAssignments()
	{
		$this->auth->assign('deletePost','author B');
		$auths=$this->auth->getAuthAssignments('author B');
		$this->assertEquals(2,count($auths));
		$this->assertTrue(reset($auths) instanceof CAuthAssignment);
	}

	public function testGetAuthItems()
	{
		$this->assertEquals(count($this->auth->getRoles()),4);
		$this->assertEquals(count($this->auth->getOperations()),4);
		$this->assertEquals(count($this->auth->getTasks()),1);
		$this->assertEquals(count($this->auth->getAuthItems()),9);

		$this->assertEquals(count($this->auth->getAuthItems(null,'author B')),1);
		$this->assertEquals(count($this->auth->getAuthItems(null,'author C')),0);
		$this->assertEquals(count($this->auth->getAuthItems(CAuthItem::TYPE_ROLE,'author B')),1);
		$this->assertEquals(count($this->auth->getAuthItems(CAuthItem::TYPE_OPERATION,'author B')),0);
	}

	public function testClearAll()
	{
		$this->auth->clearAll();
		$this->assertEquals(count($this->auth->getRoles()),0);
		$this->assertEquals(count($this->auth->getOperations()),0);
		$this->assertEquals(count($this->auth->getTasks()),0);
		$this->assertEquals(count($this->auth->getAuthItems()),0);
		$this->assertEquals(count($this->auth->getAuthAssignments('author B')),0);
	}

	public function testClearAuthAssignments()
	{
		$this->auth->clearAuthAssignments();
		$this->assertEquals(count($this->auth->getAuthAssignments('author B')),0);
	}

	public function testDetectLoop()
	{
		$this->setExpectedException('CException');
		$this->auth->addItemChild('readPost','readPost');
	}

	public function testExecuteBizRule()
	{
		$this->assertTrue($this->auth->executeBizRule(null,array(),null));
		$this->assertTrue($this->auth->executeBizRule('return 1==true;',array(),null));
		$this->assertTrue($this->auth->executeBizRule('return $params[0]==$params[1];',array(1,'1'),null));
		$this->assertFalse($this->auth->executeBizRule('invalid',array(),null));
	}

	public function testCheckAccess()
	{
		$results=array(
			'reader A'=>array(
				'createPost'=>false,
				'readPost'=>true,
				'updatePost'=>false,
				'updateOwnPost'=>false,
				'deletePost'=>false,
			),
			'author B'=>array(
				'createPost'=>true,
				'readPost'=>true,
				'updatePost'=>true,
				'updateOwnPost'=>true,
				'deletePost'=>false,
			),
			'editor C'=>array(
				'createPost'=>false,
				'readPost'=>true,
				'updatePost'=>true,
				'updateOwnPost'=>false,
				'deletePost'=>false,
			),
			'admin D'=>array(
				'createPost'=>true,
				'readPost'=>true,
				'updatePost'=>true,
				'updateOwnPost'=>false,
				'deletePost'=>true,
			),
		);

		$params=array('authorID'=>'author B');

		foreach(array('reader A','author B','editor C','admin D') as $user)
		{
			$params['userID']=$user;
			foreach(array('createPost','readPost','updatePost','updateOwnPost','deletePost') as $operation)
			{
				$result=$this->auth->checkAccess($operation,$user,$params);
				$this->assertEquals($results[$user][$operation],$result);
			}
		}
	}

	protected function prepareData()
	{
		$this->auth->createOperation('createPost','create a post');
		$this->auth->createOperation('readPost','read a post');
		$this->auth->createOperation('updatePost','update a post');
		$this->auth->createOperation('deletePost','delete a post');

		$task=$this->auth->createTask('updateOwnPost','update a post by author himself','return $params["authorID"]==$params["userID"];');
		$task->addChild('updatePost');

		$role=$this->auth->createRole('reader');
		$role->addChild('readPost');

		$role=$this->auth->createRole('author');
		$role->addChild('reader');
		$role->addChild('createPost');
		$role->addChild('updateOwnPost');

		$role=$this->auth->createRole('editor');
		$role->addChild('reader');
		$role->addChild('updatePost');

		$role=$this->auth->createRole('admin');
		$role->addChild('editor');
		$role->addChild('author');
		$role->addChild('deletePost');

		$this->auth->assign('reader','reader A');
		$this->auth->assign('author','author B');
		$this->auth->assign('editor','editor C');
		$this->auth->assign('admin','admin D');
	}
}


code:
<?php

require_once(dirname(__FILE__).'/AuthManagerTestBase.php');

class CDbAuthManagerTest extends AuthManagerTestBase
{
	private $db;

	public function setUp()
	{
		if(!extension_loaded('pdo') || !extension_loaded('pdo_pgsql'))
			$this->markTestSkipped('PDO and PostgreSQL extensions are required.');

		$schemaFile=realpath(dirname(__FILE__).'/schema.sql');

		$this->db=new CDbConnection('pgsql:host=localhost;dbname=yii','test','test');
		try
		{
			$this->db->active=true;
		}
		catch(Exception $e)
		{
			$this->markTestSkipped("Please read $schemaFile for details on setting up the test environment for PostgreSQL test case.");
		}

		$sqls=file_get_contents($schemaFile);
		foreach(explode(';',$sqls) as $sql)
		{
			if(trim($sql)!=='')
				$this->db->createCommand($sql)->execute();
		}
		$this->db->active=false;

		$this->auth=new CDbAuthManager;
		$this->auth->db=$this->db;
		$this->auth->init();
		$this->prepareData();
	}

	public function tearDown()
	{
		if($this->db)
			$this->db->active=false;
	}
}


code:
<?php

require_once(dirname(__FILE__).'/AuthManagerTestBase.php');

class CPhpAuthManagerTest extends AuthManagerTestBase
{
	public function setUp()
	{
		$authFile=dirname(__FILE__).'/data/auth.php';
		@unlink($authFile);
		$this->auth=new CPhpAuthManager;
		$this->auth->authFile=$authFile;
		$this->auth->init();
		$this->prepareData();
	}

	public function tearDown()
	{
		@unlink($this->auth->authFile);
	}

	public function testSaveLoad()
	{
		$this->auth->save();
		$this->auth->clearAll();
		$this->auth->load();
		$this->testCheckAccess();
	}
}


code:
drop table if exists authassignment cascade;
drop table if exists authitemchild cascade;
drop table if exists authitem cascade;

create table authitem
(
   name                 varchar(64) not null,
   type                 integer not null,
   description          text,
   bizrule              text,
   data                 text,
   primary key (name)
);

create table authitemchild
(
   parent               varchar(64) not null,
   child                varchar(64) not null,
   primary key (parent,child),
   foreign key (parent) references authitem (name) on delete cascade on update cascade,
   foreign key (child) references authitem (name) on delete cascade on update cascade
);

create table authassignment
(
   itemname             varchar(64) not null,
   userid               varchar(64) not null,
   bizrule              text,
   data                 text,
   primary key (itemname,userid),
   foreign key (itemname) references authitem (name) on delete cascade on update cascade
);


code:
<?php
Yii::import('system.db.CDbConnection');
Yii::import('system.db.ar.CActiveRecord');

require_once(dirname(__FILE__).'/../../db/data/models.php');

/**
 * CJSON Test
 */
class CJSONTest extends CTestCase {
	private $db;

	protected function setUp()
	{
		if(!extension_loaded('pdo') || !extension_loaded('pdo_sqlite'))
			$this->markTestSkipped('PDO and SQLite extensions are required.');

		$this->db=new CDbConnection('sqlite::memory:');
		$this->db->active=true;
		$this->db->pdoInstance->exec(file_get_contents(dirname(__FILE__).'/../../db/data/sqlite.sql'));
		CActiveRecord::$db=$this->db;
	}

	protected function tearDown()
	{
		$this->db->active=false;
	}

	/**
	 * native json_encode can't do it
	 * @return void
	 */
	public function testEncodeSingleAR(){
		$post = Post::model()->findByPk(1);
		$this->assertEquals(
			'{"id":"1","title":"post 1","create_time":"100000","author_id":"1","content":"content 1"}',
			CJSON::encode($post)
		);
	}

	/**
	 * native json_encode can't do it
	 * @return void
	 */
	public function testEncodeMultipleARs(){
		$posts=Post::model()->findAllByPk(array(1, 2));
		$this->assertEquals(
			'[{"id":"1","title":"post 1","create_time":"100000","author_id":"1","content":"content 1"},{"id":"2","title":"post 2","create_time":"100001","author_id":"2","content":"content 2"}]',
			CJSON::encode($posts)
		);
	}

	public function testEncodeSimple(){
		$this->assertEquals("true", CJSON::encode(true));
		$this->assertEquals("false", CJSON::encode(false));
		$this->assertEquals("null", CJSON::encode(null));
		$this->assertEquals("123", CJSON::encode(123));
		$this->assertEquals("123.12", CJSON::encode(123.12));
		$this->assertEquals('"test\\\\me"', CJSON::encode('test\me'));
	}

	public function testEncodeArray(){
		$objArr = array('a' => 'b');
		$arrArr = array('a', 'b');
		$mixedArr = array('c', 'a' => 'b');
		$nestedArr = array('a', 'b' => array('a', 'b' => 'c'));

		$this->assertEquals('{"a":"b"}', CJSON::encode($objArr));
		$this->assertEquals('["a","b"]', CJSON::encode($arrArr));
		$this->assertEquals('{"0":"c","a":"b"}', CJSON::encode($mixedArr));
		$this->assertEquals('{"0":"a","b":{"0":"a","b":"c"}}', CJSON::encode($nestedArr));
	}

	public function testDecode(){
		$this->assertEquals(array('c', 'a' => 'b'), CJSON::decode('{"0":"c","a":"b"}'));
		$this->assertEquals(array('a', 'b'), CJSON::decode('["a","b"]'));
		$this->assertEquals(array('a', 'b' => array('a', 'b' => 'c')), CJSON::decode('{"0":"a","b":{"0":"a","b":"c"}}'));
	}
}


code:
<phpunit bootstrap="bootstrap.php"
		colors="false"
		convertErrorsToExceptions="true"
		convertNoticesToExceptions="true"
		convertWarningsToExceptions="true"
		stopOnFailure="false">
</phpunit>


code:
This folder contains unit tests of Yii framework.
PHPUnit 3.5+ and xdebug (for code coverage report) are required.

To run a single unit test, use:
>> phpunit path/to/test.php

To run all tests under a directory, use:
>> phpunit --verbose path/to/tests/directory

To generate code coverage report:
>> phpunit --coverage-html reports path/to/tests/directory/or/test/class

Please use 'phpunit --help' to see more command line options.


code: phpunit --verbose framework


code:
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs     diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln       merge=binary
#*.csproj    merge=binary
#*.vbproj    merge=binary
#*.vcxproj   merge=binary
#*.vcproj    merge=binary
#*.dbproj    merge=binary
#*.fsproj    merge=binary
#*.lsproj    merge=binary
#*.wixproj   merge=binary
#*.modelproj merge=binary
#*.sqlproj   merge=binary
#*.wwaproj   merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg   binary
#*.png   binary
#*.gif   binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc   diff=astextplain
#*.DOC   diff=astextplain
#*.docx  diff=astextplain
#*.DOCX  diff=astextplain
#*.dot   diff=astextplain
#*.DOT   diff=astextplain
#*.pdf   diff=astextplain
#*.PDF   diff=astextplain
#*.rtf   diff=astextplain
#*.RTF   diff=astextplain

repo_name: TSDSK/rimworld

path: .gitattributes

license: unknown


code:
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

# Visual Studio 2017 auto generated files
Generated\ Files/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# NUNIT
*.VisualState.xml
TestResult.xml

# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c

# Benchmark Results
BenchmarkDotNet.Artifacts/

# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/

# StyleCop
StyleCopReport.xml

# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc

# Chutzpah Test files
_Chutzpah*

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb

# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap

# Visual Studio Trace Files
*.e2e

# TFS 2012 Local Workspace
$tf/

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding add-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json

# Visual Studio code coverage results
*.coverage
*.coveragexml

# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*

# MightyMoose
*.mm.*
AutoTest.Net/

# Web workbench (sass)
.sass-cache/

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj

# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets

# Microsoft Azure Build Output
csx/
*.build.csdef

# Microsoft Azure Emulator
ecf/
rcf/

# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx

# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/

# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs

# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk

# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak

# SQL Server files
*.mdf
*.ldf
*.ndf

# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- Backup*.rdl

# Microsoft Fakes
FakesAssemblies/

# GhostDoc plugin setting file
*.GhostDoc.xml

# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/

# Visual Studio 6 build log
*.plg

# Visual Studio 6 workspace options file
*.opt

# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions

# Paket dependency manager
.paket/paket.exe
paket-files/

# FAKE - F# Make
.fake/

# JetBrains Rider
.idea/
*.sln.iml

# CodeRush personal settings
.cr/personal

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc

# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config

# Tabs Studio
*.tss

# Telerik's JustMock configuration file
*.jmconfig

# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs

# OpenCover UI analysis results
OpenCover/

# Azure Stream Analytics local run output
ASALocalRun/

# MSBuild Binary and Structured Log
*.binlog

# NVidia Nsight GPU debugger configuration file
*.nvuser

# MFractors (Xamarin productivity tool) working folder
.mfractor/

# Local History for Visual Studio
.localhistory/

# BeatPulse healthcheck temp database
healthchecksdb
/Source/Patches/PawnAnimationPatches/HarmonyPatch_Pawn_DrawTracker.cs
/Source/Patches/PawnAnimationPatches/HarmonyPatch_PawnRotation.cs
/Source/Patches/PawnAnimationPatches/HarmonyPatch_PawnRenderer.cs
/Source/Patches/OtherModPatches/HarmonyPatch_ShowHairWithHats.cs
/Source/Patches/OtherModPatches/HarmonyPatch_FacialAnimation.cs
/Source/Patches/OtherModPatches/HarmonyPatch_DontShaveYourHead.cs
/Source/Patches/OtherModPatches/HarmonyPatch_CSL.cs
/Source/Patches/OtherModPatches/HarmonyPatch_AlienRace.cs
/Source/Patches/ThingAnimationPatches/HarmonyPatch_ThingDrawAt.cs
/Defs/AnimationDefs/Animations_SexToys.xml

path: .gitignore