Example #1
0
 public function testUnsetUserPassword()
 {
     $request = new Request();
     e::expose($request)->attr('username', 'bob')->attr('password', 'Pa$$worD');
     $this->assertSame($request, $request->unsetUserPassword());
     $this->assertAttributeSame(null, 'username', $request);
     $this->assertAttributeSame(null, 'password', $request);
 }
Example #2
0
<?php

// Load test target classes
spl_autoload_register(function ($c) {
    @(include_once strtr($c, '\\_', '//') . '.php');
});
set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ . '/Source');
use Expose\Expose as e;
class Object
{
    private $_secret;
    protected $_protected;
    private function _hello($world = 'World')
    {
        return sprintf('Hello, %s', $world);
    }
}
$object = new Object();
// Expose non-public properties
e::expose($object)->attr('_secret', 'foo')->attr('_protected', 'bar');
// Call non-public method
$result = e::expose($object)->call('_hello', 'Suin');
Example #3
0
 /**
  * @expectedException \Qiita\QiitaException
  * @expectedExceptionMessage Response code is 503
  */
 public function test_autenticate_fails_due_to_Service_Temporarily_Unavailable()
 {
     $response = m::mock('\\Qiita\\HTTP\\ResponseInterface');
     $response->shouldReceive('getCode')->andReturn(503)->atLeast(1);
     $request = m::mock('\\Qiita\\HTTP\\RequestInterface');
     $request->shouldReceive('setUserPassword');
     $request->shouldReceive('execute')->andReturn($response);
     $qiita = $this->newQiitaPartialMock(array('_newRequest'));
     $qiita->expects($this->once())->method('_newRequest')->will($this->returnValue($request));
     // Test
     e::expose($qiita)->call('_authenticate', 'bob', 'pa$$worD');
 }
Example #4
0
 public function test_doSomething()
 {
     $sample = new Sample();
     $this->assertSame('You may not be able to call this ordinarily', Expose::expose($sample)->call('_doSomething'));
 }
Example #5
0
 public function test_newHTTPRequest()
 {
     $client = new Client('foo', 'bar');
     $this->assertInstanceOf('\\DMM\\HTTP\\RequestInterface', e::expose($client)->call('_newHTTPRequest'));
 }