当前位置: 首页>>代码示例>>PHP>>正文


PHP Mockery::self方法代码示例

本文整理汇总了PHP中Mockery::self方法的典型用法代码示例。如果您正苦于以下问题:PHP Mockery::self方法的具体用法?PHP Mockery::self怎么用?PHP Mockery::self使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mockery的用法示例。


在下文中一共展示了Mockery::self方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 protected function setUp()
 {
     $this->app = m::mock(Container::class);
     $this->app->shouldReceive('make')->andReturn(m::self());
     $this->cache = m::mock(CacheManager::class);
     $this->manager = new MetaDataManager($this->app);
 }
开发者ID:ryan-senn,项目名称:orm,代码行数:7,代码来源:MetaDataManagerTest.php

示例2: testRotate

 public function testRotate()
 {
     $newProfile = $this->getFaker()->word;
     $encryptor = \Mockery::mock('Giftcards\\Encryption\\Encryptor');
     $observer = \Mockery::mock('Giftcards\\Encryption\\CipherText\\Rotator\\ObserverInterface');
     $fields = $this->fields;
     $fields[] = $this->idField;
     $faker = $this->getFaker();
     $row1 = array_combine($fields, array_map(function () use($faker) {
         return $faker->unique()->word;
     }, $fields));
     $row2 = array_combine($fields, array_map(function () use($faker) {
         return $faker->unique()->word;
     }, $fields));
     $row3 = array_combine($fields, array_map(function () use($faker) {
         return $faker->unique()->word;
     }, $fields));
     $this->connection->shouldReceive('createQueryBuilder')->once()->andReturn(\Mockery::mock()->shouldReceive('select')->once()->with($fields)->andReturn(\Mockery::self())->getMock()->shouldReceive('from')->once()->with($this->table)->andReturn(\Mockery::self())->getMock()->shouldReceive('execute')->once()->andReturn(\Mockery::mock()->shouldReceive('fetch')->times(4)->with(\PDO::FETCH_ASSOC)->andReturn($row1, $row2, $row3, false)->getMock())->getMock());
     $observer->shouldReceive('rotating')->once()->ordered()->with($row1[$this->idField])->getMock()->shouldReceive('rotated')->once()->ordered()->with($row1[$this->idField])->getMock()->shouldReceive('rotating')->once()->ordered()->with($row2[$this->idField])->getMock()->shouldReceive('rotated')->once()->ordered()->with($row2[$this->idField])->getMock()->shouldReceive('rotating')->once()->ordered()->with($row3[$this->idField])->getMock()->shouldReceive('rotated')->once()->ordered()->with($row3[$this->idField])->getMock();
     foreach (array($row1, $row2, $row3) as $row) {
         $encryptedRow = array();
         foreach ($row as $field => $value) {
             if ($field == $this->idField) {
                 continue;
             }
             $encryptor->shouldReceive('decrypt')->once()->with($value)->andReturn($decrypted = $this->getFaker()->unique()->word)->getMock()->shouldReceive('encrypt')->once()->with($decrypted, $newProfile)->andReturn($encrypted = $this->getFaker()->unique()->word)->getMock();
             $encryptedRow[$field] = $encrypted;
         }
         $this->connection->shouldReceive('update')->once()->with($this->table, $encryptedRow, array($this->idField => $row[$this->idField]));
     }
     $this->rotator->rotate($observer, $encryptor, $newProfile);
 }
开发者ID:SaveYa,项目名称:Encryption,代码行数:32,代码来源:DoctrineDBALRotatorTest.php

示例3: testJob_Is_Not_Find

 public function testJob_Is_Not_Find()
 {
     $this->fixture->shouldReceive('getJobByVacancyId')->with(2)->andReturn(\Mockery::self())->atLeast(1);
     $this->fixture->shouldReceive('extendJob')->andReturn(true)->atLeast(1);
     $parser = new Parser([], $this->fixture);
     $parser->parseVacancy(2, null);
 }
开发者ID:Zlob,项目名称:SkillCompass,代码行数:7,代码来源:ParserTest.php

示例4: endTest

 /**
  * endTest is called after each test and checks if \Mockery::close() has
  * been called, and will let the test fail if it hasn't.
  *
  * @param  PHPUnit_Framework_Test $test
  * @param  float                  $time
  */
 public function endTest(\PHPUnit_Framework_Test $test, $time)
 {
     if (!$test instanceof \PHPUnit_Framework_TestCase) {
         // We need the getTestResultObject and getStatus methods which are
         // not part of the interface.
         return;
     }
     if ($test->getStatus() !== \PHPUnit_Runner_BaseTestRunner::STATUS_PASSED) {
         // If the test didn't pass there is no guarantee that
         // verifyMockObjects and assertPostConditions have been called.
         // And even if it did, the point here is to prevent false
         // negatives, not to make failing tests fail for more reasons.
         return;
     }
     try {
         // The self() call is used as a sentinel. Anything that throws if
         // the container is closed already will do.
         \Mockery::self();
     } catch (\LogicException $_) {
         return;
     }
     $e = new \PHPUnit_Framework_ExpectationFailedException(sprintf("Mockery's expectations have not been verified. Make sure that \\Mockery::close() is called at the end of the test. Consider using %s\\MockeryPHPUnitIntegration or extending %s\\MockeryTestCase.", __NAMESPACE__, __NAMESPACE__));
     $result = $test->getTestResultObject();
     $result->addFailure($test, $e, $time);
 }
开发者ID:padraic,项目名称:mockery,代码行数:32,代码来源:TestListener.php

示例5: _before

 protected function _before()
 {
     $serviceLocator = \Mockery::mock('Zend\\ServiceManager\\ServiceLocatorInterface');
     $serviceLocator->shouldReceive('get')->with('elasticsearch')->andReturn(\Mockery::self());
     $serviceLocator->shouldReceive('search')->with(array('index' => 'test-index', 'body' => 'test-query'))->andReturn(array('test-response', 'test-data'));
     $this->service = new ElasticSearch($serviceLocator);
 }
开发者ID:TransformCore,项目名称:elasticsearch-sandbox,代码行数:7,代码来源:ElasticSearchTest.php

示例6: setUp

 protected function setUp()
 {
     $this->app = m::mock(Container::class);
     $this->app->shouldReceive('make')->andReturn(m::self());
     $this->app->shouldReceive('get')->with('doctrine.cache.default', 'array')->andReturn('array');
     $this->manager = new CacheManager($this->app);
 }
开发者ID:Devitek,项目名称:orm,代码行数:7,代码来源:CacheManagerTest.php

示例7: testGetLoggedUserId

 public function testGetLoggedUserId()
 {
     $authenticator_mock = \Mockery::mock('Jacopo\\Authentication\\SentryAuthenticator');
     $authenticator_mock->shouldReceive('getLoggedUser')->once()->andReturn(\Mockery::self())->shouldReceive('toArray')->once()->andReturn(['id' => 'foobar']);
     $this->app->instance('authenticator', $authenticator_mock);
     assertThat($this->authMgr()->getLoggedUserId(), identicalTo('foobar'));
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:7,代码来源:AuthenticatorAuthMgrTest.php

示例8: testConfigureOptionsResolver

 public function testConfigureOptionsResolver()
 {
     $this->factory->configureOptionsResolver(\Mockery::mock('Symfony\\Component\\OptionsResolver\\OptionsResolver')->shouldReceive('setRequired')->once()->with(array('container'))->andReturn(\Mockery::self())->getMock()->shouldReceive('setAllowedTypes')->once()->with(array('container' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface'))->andReturn(\Mockery::self())->getMock());
     $container = new Container();
     $factory = new ContainerParametersSourceBuilder($container);
     $factory->configureOptionsResolver(\Mockery::mock('Symfony\\Component\\OptionsResolver\\OptionsResolver')->shouldReceive('setRequired')->once()->with(array('container'))->andReturn(\Mockery::self())->getMock()->shouldReceive('setAllowedTypes')->once()->with(array('container' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface'))->andReturn(\Mockery::self())->getMock()->shouldReceive('setDefaults')->once()->with(array('container' => $container))->andReturn(\Mockery::self())->getMock());
 }
开发者ID:SaveYa,项目名称:Encryption,代码行数:7,代码来源:ContainerParametersSourceBuilderTest.php

示例9: testAuthenticatingWithQueryStringSucceedsAndReturnsUserObject

 public function testAuthenticatingWithQueryStringSucceedsAndReturnsUserObject()
 {
     $request = Request::create('foo', 'GET', ['token' => 'foo']);
     $this->auth->shouldReceive('setToken')->with('foo')->andReturn(m::self());
     $this->auth->shouldReceive('authenticate')->once()->andReturn((object) ['id' => 1]);
     $this->assertEquals(1, $this->provider->authenticate($request, m::mock('Dingo\\Api\\Routing\\Route'))->id);
 }
开发者ID:leloulight,项目名称:laravel_latest,代码行数:7,代码来源:JWTTest.php

示例10: testSetLookUpIdCallsApaiioDependencyCorrectly

 public function testSetLookUpIdCallsApaiioDependencyCorrectly()
 {
     $apai_op_mock = Mockery::mock('ApaiIO\\Operations\\Lookup');
     $apai_op_mock->shouldReceive('setItemId')->once()->with('stub item id')->andReturn(Mockery::self());
     $this->app->instance('ApaiIO\\Operations\\Lookup', $apai_op_mock);
     $lookup_op = $this->app->make('Giftertipster\\Service\\Api\\AmzProductApi\\ApaiIO\\Operations\\LookupOperation');
     $response = $lookup_op->setItemId('stub item id');
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:8,代码来源:ApaiIOLookupOperationTest.php

示例11: setUp

 protected function setUp()
 {
     $this->app = m::mock(Container::class);
     $this->app->shouldReceive('make')->andReturn(m::self());
     $this->config = m::mock(Repository::class);
     $this->config->shouldReceive('get');
     $this->manager = new ConnectionManager($this->app);
 }
开发者ID:Devitek,项目名称:orm,代码行数:8,代码来源:ConnectionManagerTest.php

示例12: testFlush

 public function testFlush()
 {
     $cache = $this->getCache();
     $cache->shouldReceive('flush');
     $cache->shouldReceive('getStore')->andReturn(m::self());
     $transCache = new TransCache($cache);
     $transCache->flush();
 }
开发者ID:mint-soft-com,项目名称:xpressengine,代码行数:8,代码来源:TransCacheTest.php

示例13: getPropelQuery

 protected function getPropelQuery($model, $results)
 {
     $mock = Mockery::mock('overload:PropelQuery');
     $mock->shouldReceive('from')->once()->with($model)->andReturn(\Mockery::self());
     $mock->shouldReceive('setFormatter')->once()->with('PropelOnDemandFormatter')->andReturn(\Mockery::self());
     $mock->shouldReceive('find')->once()->andReturn($results);
     return $mock;
 }
开发者ID:sitemap-php,项目名称:propel-provider,代码行数:8,代码来源:PropelTest.php

示例14: testGetSchema

 public function testGetSchema()
 {
     $connection = M::mock('Fuel\\Database\\Connection');
     $connection->shouldReceive('getSchemaManager')->andReturn(M::self());
     $connection->shouldReceive('createSchema')->andReturn('called');
     $schema = new Schema($connection);
     $this->assertEquals('called', $schema->getSchema());
 }
开发者ID:DoctorSanchez,项目名称:database,代码行数:8,代码来源:SchemaTest.php

示例15: getConn

 protected function getConn()
 {
     $conn = m::mock(\Xpressengine\Database\VirtualConnectionInterface::class);
     $conn->shouldReceive('where')->andReturn(m::self());
     $conn->shouldReceive('table')->andReturn(m::self());
     $conn->shouldReceive('insert')->andReturn(m::self());
     $conn->shouldReceive('update')->andReturn(m::self());
     return $conn;
 }
开发者ID:mint-soft-com,项目名称:xpressengine,代码行数:9,代码来源:TransCachedDatabaseTest.php


注:本文中的Mockery::self方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。