本文整理汇总了PHP中BaseTestCase类的典型用法代码示例。如果您正苦于以下问题:PHP BaseTestCase类的具体用法?PHP BaseTestCase怎么用?PHP BaseTestCase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BaseTestCase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testClearApplicationData
public function testClearApplicationData()
{
// Verifica se está tudo ok
$this->BaseTestCase->setApplicationConstants();
if (!is_writable(APPLICATION_DATA)) {
$this->fail('APPLICATION_DATA ' . APPLICATION_DATA . ' não tem permissão de escrita');
}
// Grava umas bobeiras la
$folder = APPLICATION_DATA . '/teste1';
if (!file_exists($folder)) {
$oldumask = umask(0);
mkdir($folder);
umask($oldumask);
}
file_put_contents($folder . '/test1.txt', 'teste');
$folder = APPLICATION_DATA . '/teste2/teste3';
if (!file_exists($folder)) {
$oldumask = umask(0);
mkdir($folder, 0777, true);
umask($oldumask);
}
file_put_contents($folder . '/sample.txt', 'teste teste');
// Verifica se a pasta está vazia
$this->assertFalse($this->BaseTestCase->isApplicationDataEmpty());
$this->BaseTestCase->clearApplicationData();
// Verifica se está vazia
$files = $objects = scandir(APPLICATION_DATA);
$this->assertCount(3, $files, 'não tem mais nada no APPLICATION_DATA');
$this->assertEquals(array('.', '..', '.gitignore'), $files, 'não tem mais nada no APPLICATION_DATA');
// Verifica se a pasta está vazia
$this->assertTrue($this->BaseTestCase->isApplicationDataEmpty());
// Grava mais coisa no raiz do APPLICATION_DATA
file_put_contents(APPLICATION_DATA . '/sample.txt', 'outro teste');
// Verifica se a pasta está vazia depois de apagar
$this->assertFalse($this->BaseTestCase->isApplicationDataEmpty());
$this->assertTrue($this->BaseTestCase->clearApplicationData());
}
开发者ID:realejo,项目名称:library-zf1,代码行数:37,代码来源:BaseTestCaseTest.php
示例2: setUp
public function setUp()
{
parent::setUp();
if (!isset($GLOBALS['PHPUNIT_SA_LEARN_ENABLED']) || $GLOBALS['PHPUNIT_SA_LEARN_ENABLED'] == 0) {
$this->markTestSkipped('To test the learning behavior, enable the TELL ' . 'command in SpamAssassin and update phpunit.xml');
}
}
开发者ID:perk11,项目名称:php-spamassassin,代码行数:7,代码来源:RevokeTest.php
示例3: setup
function setup()
{
parent::setup();
$app = Prado::getApplication();
$this->userDao = $app->getModule('daos')->getDao('UserDao');
$this->flushDatabase();
}
开发者ID:Nurudeen,项目名称:prado,代码行数:7,代码来源:UserDaoTestCase.php
示例4: setup
/**
* Initialisation of config object
*
* @author Eddie Jaoude
* @param null
* @return null
*
*/
public function setup()
{
parent::setUp();
$this->assertEquals(TRUE, is_object($this->_em));
$this->model = $this->_em->getRepository('Auth_Model_Account');
$this->appConfigAuth = new Zend_Config_Ini(APPLICATION_PATH . '/modules/auth/configs/auth.ini', APPLICATION_ENV);
}
开发者ID:MarS2806,项目名称:Zend-Framework--Doctrine-ORM--PHPUnit--Ant--Jenkins-CI--TDD-,代码行数:15,代码来源:AccountTest.php
示例5: tearDown
/**
* Cleans up the environment after running a test.
*/
protected function tearDown()
{
// TODO Auto-generated RW_App_Model_UploadTest::tearDown()
$this->RW_App_Model_Upload = null;
$this->clearApplicationData();
parent::tearDown();
}
开发者ID:realejo,项目名称:library-zf1,代码行数:10,代码来源:UploadTest.php
示例6: tearDown
/**
* Cleans up the environment after running a test.
*/
protected function tearDown()
{
parent::tearDown();
$this->dropTables();
unset($this->Base);
$this->clearApplicationData();
}
开发者ID:realejo,项目名称:library-zf1,代码行数:10,代码来源:BaseExtendedWhereTest.php
示例7: setUpPage
public function setUpPage()
{
$this->timeouts()->implicitWait(3000);
if (!self::$indexed) {
$this->url('/wp-admin/');
if ('Vagrant › Log In' == $this->title()) {
$this->byId('user_login')->click();
$this->keys('admin');
sleep(1);
// some reason too fast?
$this->byId('user_pass')->click();
$this->keys('vagrant');
$this->byId('wp-submit')->click();
}
$this->waitForTitle('Dashboard ‹ Vagrant — WordPress');
$this->url('http://localhost:8080/wordpress/wp-admin/admin.php?page=elastic_search&tab=index');
$this->assertEquals('ElasticSearch ‹ Vagrant — WordPress', $this->title());
sleep(1);
// some reason too fast?
$this->byId('wipedata')->click();
$this->byId('nhp-opts-save');
sleep(1);
$this->byId('reindex')->click();
$this->byCssSelector(".complete");
self::$indexed = true;
// give index time to refresh, would rather call refresh on index directly, too lazy :)
sleep(5);
}
}
开发者ID:viz,项目名称:wordpress-fantastic-elasticsearch,代码行数:29,代码来源:BaseTestCase.php
示例8: setUp
public function setUp()
{
parent::setUp();
$this->status_column = 'status';
$this->moderated_at_column = 'moderated_at';
Post::$strictModeration = true;
}
开发者ID:cryptixcoder,项目名称:laravel-moderation,代码行数:7,代码来源:ModerationTraitTest.php
示例9: setUp
public function setUp()
{
parent::setUp();
$this->posts = new PostRepository();
$this->artisan('migrate', ['--database' => 'testbench', '--realpath' => realpath(__DIR__ . '/../migrations')]);
$this->withFactories(realpath(__DIR__ . '/../factories'));
}
开发者ID:dannyweeks,项目名称:laravel-base-repository,代码行数:7,代码来源:EloquentIntegrationTest.php
示例10: tearDown
/**
* Cleans up the environment after running a test.
*/
protected function tearDown()
{
parent::tearDown();
// Não inicializa o APPLICATION_DATA pois alguns testes exigem que ele não exista
//@todo é possível ser condicional? teste case separado?
// Remove as pastas criadas
//$this->clearApplicationData();
}
开发者ID:realejo,项目名称:library-zf1,代码行数:11,代码来源:CacheTest.php
示例11: setUp
public function setUp()
{
parent::setUp();
\DB::enableQueryLog();
$this->artisan('migrate', ['--database' => 'testbench', '--realpath' => realpath(__DIR__ . '/../migrations')]);
$this->withFactories(realpath(__DIR__ . '/../factories'));
$this->repo = new CachingRepository();
}
开发者ID:dannyweeks,项目名称:laravel-base-repository,代码行数:8,代码来源:CachingTraitTest.php
示例12: tearDown
/**
* Cleans up the environment after running a test.
*/
protected function tearDown()
{
parent::tearDown();
$this->dropTables();
unset($this->Db);
// Remove as pastas criadas
$this->clearApplicationData();
}
开发者ID:realejo,项目名称:library-zf1,代码行数:11,代码来源:DbTest.php
示例13: setUp
public function setUp()
{
parent::setUp();
$this->data = new Matrix(10, 10);
$this->data->set(1, 1, 0);
$this->data->set(1, 2, 0);
$this->board = new Battleships\Board($this->data);
}
开发者ID:plamen-paskov,项目名称:battleships,代码行数:8,代码来源:BoardTest.php
示例14: setup
function setup()
{
parent::setup();
$app = Prado::getApplication();
$this->categoryDao = $app->getModule('daos')->getDao('CategoryDao');
$this->projectDao = $app->getModule('daos')->getDao('ProjectDao');
$this->flushDatabase();
}
开发者ID:Nurudeen,项目名称:prado,代码行数:8,代码来源:CategoryDaoTestCase.php
示例15: tearDown
public function tearDown()
{
MysqlUser::truncate();
MysqlBook::truncate();
MysqlRole::truncate();
Book::truncate();
parent::tearDown();
}
开发者ID:Symfomany,项目名称:laravel-mongo,代码行数:8,代码来源:MysqlRelationsTest.php
示例16: testUpdateOwnedIdentities
public function testUpdateOwnedIdentities()
{
parent::resetMongo();
Doctrine::loadData(dirname(__FILE__) . '/fixtures');
$lUserHugo = UserTable::getByIdentifier('hugo');
$lUserHugo->updateOwnedIdentities(array("1", "2", "34"));
$lRelation = $lUserHugo->retrieveUserRelations();
$this->assertTrue(in_array("34", $lRelation->getOwnedOi()));
}
开发者ID:42medien,项目名称:spreadly,代码行数:9,代码来源:UserTest.php
示例17: setUp
public function setUp()
{
parent::resetMongo();
sfConfig::set('sf_environment', 'test');
Doctrine::loadData(dirname(__FILE__) . '/fixtures');
sfConfig::set('sf_environment', 'dev');
$this->from = date('Y-m-d', strtotime("today"));
$this->to = date('Y-m-d', strtotime("tomorrow"));
}
开发者ID:42medien,项目名称:spreadly,代码行数:9,代码来源:ChartDataHelperTest.php
示例18: setUp
public function setUp()
{
parent::setUp();
$this->requestor = new Requestor($this->client);
// Attach mock requestor
$httpClient = $this->requestor->getHttpClient();
$stream = Stream::factory(json_encode([['id' => 'abcd1234', 'year' => 2001, 'make' => 'Volkswagen', 'model' => 'Passat', 'color' => '#fafafa', 'display_name' => 'My Passat']]));
$mock = new Mock([new Response(200, [], $stream)]);
$httpClient->getEmitter()->attach($mock);
}
开发者ID:srtfisher,项目名称:automatic,代码行数:10,代码来源:RequestorTest.php
示例19: setUp
/**
* @inheritdoc
*/
public function setUp()
{
parent::setUp();
// $testConfig array
$testConfig = (include __DIR__ . '/../config/config.php');
$this->configManager = ConfigManager::create($testConfig);
$this->basePath = realpath(__DIR__ . '/..');
$this->storagePath = realpath(__DIR__ . '/../storage');
$this->fileSystem = new FileSystem($this->configManager->get(), $this->basePath, $this->storagePath);
}
开发者ID:edisoncosta,项目名称:laravel-gettext,代码行数:13,代码来源:MultipleDomainTest.php
示例20: setUp
public function setUp()
{
parent::setUp();
$this->status_column = 'status';
$this->moderated_at_column = 'moderated_at';
$this->moderated_by_column = 'moderated_by';
//create a user and login
$this->actingAsUser();
Post::$strictModeration = true;
}
开发者ID:hootlex,项目名称:laravel-moderation,代码行数:10,代码来源:ModerationScopeTest.php
注:本文中的BaseTestCase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论