function testDb_TabledatagatewaySelect()
 {
     $db = new A_Db_Tabledatagateway_MockDb();
     $tdg = new Test2($db);
     $result = $tdg->find('bar');
     #$this->dump($result, "result=");
     $this->dump($db->sql, "SQL=");
     #		$this->assertEqual($tdg->getTable(), 'foo');
 }
Exemplo n.º 2
0
 public function actionAdmin()
 {
     $model = new Test2('search');
     $model->unsetAttributes();
     if (isset($_GET['Test2'])) {
         $model->setAttributes($_GET['Test2']);
     }
     $this->render('admin', array('model' => $model));
 }
Exemplo n.º 3
0
 /**
  * @covers Phossa\Shared\Message\Loader\LanguageLoader::loadMessages
  * @depends testGetLanguage
  */
 public function testLoadMessages($lang)
 {
     // nonexit class
     $res1 = $this->object->loadMessages('NonExistClass');
     $this->assertEquals([], $res1);
     // not find language file
     $res2 = $this->object->loadMessages(Test2::getClass());
     $this->assertEquals([], $res2);
     $res3 = $this->object->loadMessages(Test::getClass());
     $this->assertEquals(['lang' => $lang], $res3);
 }
Exemplo n.º 4
0
echo $form->textField($model, 'order');
?>
		<?php 
echo $form->error($model, 'order');
?>
		</div><!-- row -->
		<div class="row">
		<?php 
echo $form->labelEx($model, 'slug');
?>
		<?php 
echo $form->textField($model, 'slug', array('maxlength' => 10));
?>
		<?php 
echo $form->error($model, 'slug');
?>
		</div><!-- row -->

		<label><?php 
echo GxHtml::encode($model->getRelationLabel('test2s'));
?>
</label>
		<?php 
echo $form->checkBoxList($model, 'test2s', GxHtml::encodeEx(GxHtml::listDataEx(Test2::model()->findAllAttributes(null, true)), false, true));
?>

<?php 
echo GxHtml::submitButton(Yii::t('app', 'Save'));
$this->endWidget();
?>
</div><!-- form -->
Exemplo n.º 5
0
<?php

class Test
{
    public function hello()
    {
        print "Working" . PHP_EOL;
    }
}
class Test2 extends Test
{
    public function hello2()
    {
        $this->hello();
        // Check if $this mean also inheritance methods
        parent::hello();
        // Check if it work in spite of it is not static method
    }
}
$t = new Test2();
$t->hello2();
Exemplo n.º 6
0
    {
        // echo Test::$a;
        echo parent::$a;
    }
    static function DisplayParentFun()
    {
        echo parent::Modify();
    }
    public function InstanceTest()
    {
        // echo $this->Hello();
        echo parent::Hello();
    }
    public function Hello()
    {
        echo "*********<br/>";
        parent::Hello();
        echo "*********<br/>";
    }
}
echo Test::Modify();
echo "<br/>";
echo Test2::$a . "<br/>";
echo Test2::Modify() . "<br/>";
echo Test2::DisplayParentA() . "<br/>";
echo Test2::DisplayParentFun() . "<br/>";
$object = new Test2();
$object->InstanceTest();
$object->Hello();
$object2 = new Test();
$object2->Hello();
Exemplo n.º 7
0
 /**
  * @covers ::newRandomKeyUnique
  */
 public function testNewRandomKeyUnique()
 {
     Test2::$newRandomKey = ['new-key', 'existing-key', 'existing-key2', 'existing-key3', 'agian-key'];
     $this->assertEquals('new-key', Test2::newRandomKeyUnique());
     $this->assertEquals('agian-key', Test2::newRandomKeyUnique());
 }
Exemplo n.º 8
0
<?php

$this->breadcrumbs = array(Test2::label(2), Yii::t('app', 'Index'));
$this->menu = array(array('label' => Yii::t('app', 'Create') . ' ' . Test2::label(), 'url' => array('create')), array('label' => Yii::t('app', 'Manage') . ' ' . Test2::label(2), 'url' => array('admin')));
?>

<h1><?php 
echo GxHtml::encode(Test2::label(2));
?>
</h1>

<?php 
$this->widget('zii.widgets.CListView', array('dataProvider' => $dataProvider, 'itemView' => '_view'));
Exemplo n.º 9
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUser()
 {
     return $this->hasOne(Test2::className(), ['item_id' => 'user_id']);
 }
Exemplo n.º 10
0
<?php

class Test1
{
    static function ok()
    {
        echo "bug";
    }
    static function test()
    {
        call_user_func(array("static", "ok"));
    }
}
class Test2 extends Test1
{
    static function ok()
    {
        echo "ok";
    }
}
Test2::test();
Exemplo n.º 11
0
<?php

use Zend\Http\ClientStatic;
use Zend\Json\Json;
include __DIR__ . '/../../../vendor/autoload.php';
$test = new Test2();
$test->testGetProfile();
class Test2
{
    const HOST = 'http://localhost/zfegg-admin';
    public function testGetProfile()
    {
        /*
        * GET /oauth/resource HTTP/1.1
                Accept: application/json
                Authorization: Bearer 907c762e069589c2cd2a229cdae7b8778caa9f07
        */
        $response = ClientStatic::get(self::HOST . '/profile', [], ['Accept' => 'application/json', 'Authorization' => 'Bearer 9c42215c4e2b176281a16fae909a49fa77bf85a2']);
        echo Json::prettyPrint($response->getBody());
    }
    public function testPostLogin()
    {
        $response = ClientStatic::post(self::HOST . '/login', ['username' => 'abc', 'password' => 'abc', 'captcha' => 'abc'], ['Accept' => 'application/json']);
        echo Json::prettyPrint($response->getBody());
    }
    public function testGetOauthResource()
    {
        /*
        * GET /oauth/resource HTTP/1.1
        Accept: application/json
        Authorization: Bearer 907c762e069589c2cd2a229cdae7b8778caa9f07
Exemplo n.º 12
0
{
    echo 'hello world!<br />';
}
function name($event)
{
    echo 'hi ' . $event->data . '<br />';
}
function event()
{
    echo 'hello event!<br />';
}
function event2()
{
    echo 'hello event2!<br />';
}
$test = new Test2();
$test->on('say', 'hello');
$test->on('say', 'name', 'shuru');
$test->on('say', [$test, 'test']);
$test->on('say', ['Test2', 'test_two']);
$test->trigger('say');
//会触发实例的事件
echo '<hr />';
$test->off('say', 'hello');
$test->trigger('say');
echo '<hr />';
Event::on(Test2::className(), 'say', 'event');
$test->trigger('say');
//因为该对象的类,也绑定了该事件,因此会触发类事件,类事件是在Event.php里面
echo '<hr />';
Event::on(Component::className(), 'say', 'event2');
Exemplo n.º 13
0
 function __construct($value1, $value2, $value3)
 {
     parent::__construct($value1, $value2);
     $this->member1 = $value3;
 }