コード例 #1
0
ファイル: TestSuite.php プロジェクト: Nessworthy/buan
 public function startTest($title = NULL)
 {
     $test = new UnitTest($this);
     $test->title = $title === NULL ? md5(uniqid(rand())) : $title;
     $this->testStack[$test->getId()] = $test;
     return $test;
 }
コード例 #2
0
ファイル: UnitTest.php プロジェクト: rsms/phpab
 /** @return UnitTest */
 public static function instance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
コード例 #3
0
ファイル: RouterTest.php プロジェクト: saiber/www
 public function setUp()
 {
     parent::setUp();
     $this->request = new Request();
     $this->router = new Router($this->request);
     $this->router->setBaseDir('/', '/');
 }
コード例 #4
0
ファイル: LoadReferenceTest.php プロジェクト: saiber/www
 public function tearDown()
 {
     ActiveRecordModel::executeUpdate('DROP TABLE LoadReferenceParent');
     ActiveRecordModel::executeUpdate('DROP TABLE LoadReferenceChild');
     ActiveRecordModel::executeUpdate('DROP TABLE LoadReferenceSuper');
     return parent::tearDown();
 }
コード例 #5
0
ファイル: unittest.php プロジェクト: banks/unittest
 public function action_index()
 {
     // Display all Unit tests found by default
     $tests = NULL;
     if ($this->request->param('test_dir') !== NULL) {
         $tests = UnitTest::find_tests($this->request->param('test_dir'));
     }
     // Display requested tests
     $this->request->response = UnitTest::factory($tests)->run();
 }
コード例 #6
0
ファイル: UnitDirectoryTestCase.php プロジェクト: rsms/phpab
 /**
  * Run tests
  *
  * @return void
  */
 public function test()
 {
     # Refresh assert bindings
     UnitTest::instance()->refreshAssertBindings();
     # Reset case storage & passed-cache
     $this->cases = array();
     $this->allCasesPassed = true;
     # Implementation-specific test logic
     $this->performTests();
 }
コード例 #7
0
 public function setUp()
 {
     $this->fixtures('unit_tests', 'unit_tests_more');
     // paginated collection from array
     $files = array(new File(1, 'alpha'), new File(2, 'beta'), new File(3, 'gamma'), new File(4, 'delta'), new File(5, 'epsilon'), new File(6, 'zeta'), new File(7, 'eta'), new File(8, 'theta'), new File(9, 'iota'), new File(10, 'kappa'), new File(11, 'lamda'), new File(12, 'mu'), new File(13, 'nu'), new File(14, 'xi'), new File(15, 'omikron'), new File(16, 'pi'), new File(17, 'rho'), new File(18, 'sigma'), new File(19, 'tau'), new File(20, 'upsilon'), new File(21, 'phi'), new File(22, 'chi'), new File(23, 'psi'), new File(24, 'omega'));
     $this->_array = new Mad_Model_PaginatedCollection(array_slice($files, 10, 5), 3, 5, count($files));
     // paginated collection from model collection
     $testCount = UnitTest::count();
     $tests = UnitTest::find('all', array('offset' => '5', 'limit' => '5'));
     $this->_models = new Mad_Model_PaginatedCollection($tests, 2, 5, $testCount);
 }
コード例 #8
0
ファイル: UnitTestCase.php プロジェクト: rsms/phpab
 /**
  * Run tests
  *
  * @return void
  */
 public function test()
 {
     $oldAssertionStorage =& UnitTest::instance()->getAssertionStorage();
     UnitTest::instance()->setAssertionStorage($this->assertions);
     try {
         $this->performTests();
     } catch (Exception $e) {
         $this->exception = $e;
     }
     UnitTest::instance()->setAssertionStorage($oldAssertionStorage);
     $this->updateAssertions();
 }
コード例 #9
0
 public function __construct()
 {
     parent::__construct('Godaddy Shared Hosting Compatibility');
 }
コード例 #10
0
ファイル: BaseTest.php プロジェクト: lerre/framework
 public function testEmailValidation()
 {
     $this->fixtures('unit_tests');
     $test = UnitTest::find(1);
     $test->email_value = 'asdf';
     $this->assertFalse($test->isValid());
     $this->assertTrue($test->errors->isInvalid('email_value'));
     $this->assertEquals(1, count($test->errors->on('email_value')));
     $this->assertFalse($test->save());
 }
コード例 #11
0
 function actionUnitMethod($method)
 {
     $meth = Method::model()->findByPk($method);
     if ($meth == null) {
         throw new CHttpException(404, 'Method not found :-(');
     }
     $t = UnitTest::model()->findByAttributes(array('id_method' => $method));
     if ($t != null) {
         $this->redirect(array('view', 'id' => $t->id_test));
     } else {
         $model = new Test();
         $special = new UnitTest();
         $special->id_method = $id_method;
         // Uncomment the following line if AJAX validation is needed
         // $this->performAjaxValidation($model);
         if (isset($_POST['Test'])) {
             $model->attributes = $_POST['Test'];
             $special->id_test = 0;
             if ($model->save()) {
                 $special->id_test = $model->id_test;
                 $special->save(false);
                 $this->redirect(array('view', 'id' => $model->id_test));
             }
         }
         $this->render('create', array('model' => $model, 'special' => $special));
     }
 }
コード例 #12
0
ファイル: Initialize.php プロジェクト: saiber/livecart
error_reporting(E_ALL);
if (!defined('TEST_INITIALIZED')) {
    // load classes and mount paths
    $cd = getcwd();
    $_SERVER["SCRIPT_FILENAME"] = dirname(__FILE__);
    chdir(dirname(dirname(__FILE__)));
    chdir('..');
    include_once 'application/Initialize.php';
    $arPath = realpath(getcwd() . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'activerecord' . DIRECTORY_SEPARATOR . 'ActiveRecord.php');
    include_once $arPath;
    ActiveRecord::setDSN('mysql://root@server/livecart');
    // set unittest and simpletest library root directory
    $libDir = dirname(dirname(__FILE__)) . '/_library/';
    ClassLoader::mountPath('phpunit', realpath($libDir . 'phpunit/'));
    ClassLoader::mountPath('unittest', realpath($libDir . 'unittest') . '/');
    ClassLoader::mountPath('testdir', dirname(__FILE__) . '/');
    ClassLoader::import("phpunit.*");
    ClassLoader::import("unittest.*");
    ClassLoader::import("testdir.*");
    ClassLoader::import('unittest.UnitTest');
    chdir($cd);
    define('TEST_INITIALIZED', true);
    ClassLoader::import('application.LiveCart');
    UnitTest::setApplication(new LiveCart());
    UnitTest::getApplication()->getConfig()->setAutoSave(false);
    UnitTest::getApplication()->getConfig()->set('EMAIL_METHOD', 'FAKE');
}
ClassLoader::import('application.system.*');
ClassLoader::import('library.locale.Locale');
ClassLoader::import('test.mock.Swift_Connection_Fake');
require_once 'LiveCartTest.php';
コード例 #13
0
 function __construct($debug)
 {
     $this->r = new AddictDatabase("brokenva_addicttest");
     parent::__construct($debug);
 }
コード例 #14
0
ファイル: UnitTest.php プロジェクト: lerre/framework
 public function testAssertNoDifferenceFalse()
 {
     try {
         $diff = $this->assertNoDifference('UnitTest::count()');
         UnitTest::create(array('string_value' => 'foo bar', 'integer_value' => 12345, 'email_value' => '*****@*****.**'));
         $diff->end();
     } catch (Exception $e) {
     }
     $this->assertTrue($e instanceof PHPUnit_Framework_AssertionFailedError);
 }
コード例 #15
0
 function actionUnitTest($id, $raw = 0)
 {
     $test = UnitTest::model()->findByPk($id);
     if ($test == null) {
         throw new CHttpException(404, 'Test not found');
     }
     $this->render_code('unit_test', $raw, false, array('test' => $test));
 }
コード例 #16
0
ファイル: BaseTest.php プロジェクト: lerre/framework
 public function testBeforeUpdateException()
 {
     try {
         $test = UnitTest::find(1);
         $test->updateAttributes(array('integer_value' => '123', 'string_value' => 'before update test'));
         $test->saveEx();
         $this->fail();
     } catch (Mad_Model_Exception_Validation $e) {
         // validation errors
         $this->assertEquals(1, count($test->errors));
         foreach ($test->errors->fullMessages() as $msg) {
             $this->assertEquals('String value cannot be renamed to before update test', $msg);
         }
     }
 }
コード例 #17
0
 public function setUp()
 {
     parent::setUp();
     $this->parser = new DomNodeParser();
 }
コード例 #18
0
ファイル: DbTest.php プロジェクト: samizdam/PhamilyFramework
 protected function setUp()
 {
     parent::setUp();
     $this->cleanupDb();
 }
コード例 #19
0
 public function setUp()
 {
     parent::setUp();
     $this->converter = new Converter(new DomNodeParser(), new MarkdownRenderer());
 }
コード例 #20
0
ファイル: BaseTest.php プロジェクト: lerre/framework
 public function testRenderPartialModelCollection()
 {
     $this->fixtures('unit_tests');
     $this->_view->myObjects = UnitTest::find('all', array('limit' => 2));
     $expected = '<div><p>name a</p><p>name b</p></div>';
     $this->assertEquals($expected, $this->_view->render('testPartialCollection'));
 }
コード例 #21
0
<?php

$tests = UnitTest::model()->findAll();
foreach ($tests as $t) {
    echo strtolower($t->public_id()) . ".cpp";
}
コード例 #22
0
 protected function getDataSet()
 {
     return parent::generateDataset(array("units.yml", "users.yml"));
 }
コード例 #23
0
ファイル: EventTest.php プロジェクト: vimac/zan
 public function tearDown()
 {
     parent::tearDown();
     Event::clear();
     $this->dataMap = [];
 }
コード例 #24
0
function test_row(UnitTest $test, $indentation, TableCreator $table_creator)
{
    return $table_creator->row(array($table_creator->child_indentation($indentation), $test->public_id(), $test->test->description, $test->method->name . "()", 'success'));
}
コード例 #25
0
ファイル: UniquenessTest.php プロジェクト: lerre/framework
 public function testUniqueUpdateInvalid()
 {
     $this->fixtures('unit_tests');
     $this->model = UnitTest::find(1);
     $options = array();
     $validation = Mad_Model_Validation_Base::factory('uniqueness', 'string_value', $options);
     $this->model->string_value = 'name b';
     $validation->validate('save', $this->model);
     $this->assertEquals(array('has already been taken'), $this->model->errors->on('string_value'));
 }
コード例 #26
0
ファイル: TaskTest.php プロジェクト: vimac/zan
 public function tearDown()
 {
     parent::tearDown();
 }
コード例 #27
0
 public function __construct()
 {
     parent::__construct();
     $this->instance = new OsCommerceImport('mysql://root@server/oscommerce');
     $this->importer = new LiveCartImporter($this->instance);
 }
コード例 #28
0
ファイル: UnitTest.php プロジェクト: saiber/livecart
 public static function setApplication(Application $app)
 {
     self::$application = $app;
 }
コード例 #29
0
        $ci->load->assert($this);
        $ci->dbforge->assert($this);
    }
    public function test_rename_column()
    {
        $ci =& get_instance();
        $ci->load = new Mock_Loader();
        $ci->dbforge = new Mock_DBForge();
        $ci->db = new Mock_DB();
        $ci->load->expect_call('dbforge');
        $ci->db->expect_call('field_data', 1, array('table_name'));
        $ci->dbforge->expect_call('modify_column', 1, array('table_name', array('column_name' => array('name' => 'new_column_name', 'type' => 'INT'))));
        Schema::rename_column('table_name', 'column_name', 'new_column_name');
        $ci->load->assert($this);
        $ci->dbforge->assert($this);
    }
    public function test_modify_column()
    {
        $ci =& get_instance();
        $ci->load = new Mock_Loader();
        $ci->dbforge = new Mock_DBForge();
        $ci->load->expect_call('dbforge');
        $ci->dbforge->expect_call('modify_column', 1, array('table_name', array('column_name' => array('type' => 'INT', 'other' => 'here'))));
        Schema::modify_column('table_name', 'column_name', 'integer', array('other' => 'here'));
        $ci->load->assert($this);
        $ci->dbforge->assert($this);
    }
}
if (!defined('SCHEMA_TEST_ALL')) {
    UnitTest::test();
}
コード例 #30
0
ファイル: XmlTest.php プロジェクト: lerre/framework
 public function testShouldSerializeNullBinary()
 {
     $user = new UnitTest(array('blob_value' => null));
     $xml = $user->toXml();
     $this->assertContains('<blob-value encoding="base64" type="binary" nil="true"></blob-value>', $xml);
 }