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


PHP assertInstanceOf函数代码示例

本文整理汇总了PHP中assertInstanceOf函数的典型用法代码示例。如果您正苦于以下问题:PHP assertInstanceOf函数的具体用法?PHP assertInstanceOf怎么用?PHP assertInstanceOf使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_it_can_register_user

 public function test_it_can_register_user()
 {
     $groupId = 2;
     $input = ['_token' => 'someFooToken', 'name' => 'Foo Name', 'email' => 'foo@email.com', 'username' => 'foo_user', 'password' => 'foo_pass', 'password_confirmation' => 'foo_pass'];
     $output = $this->UserManager->registerUser($input, $groupId);
     assertInstanceOf('DvsUser', $output);
 }
开发者ID:alpas29,项目名称:cms,代码行数:7,代码来源:UserManagerTest.php

示例2: test_it_can_retrieve_current_user

 public function test_it_can_retrieve_current_user()
 {
     $this->Framework->Auth->shouldReceive('id')->andReturn(1);
     $output = $this->UsersRepository->retrieveCurrentUser();
     assertInstanceOf('DvsUser', $output);
     assertEquals(1, count($output));
 }
开发者ID:alpas29,项目名称:cms,代码行数:7,代码来源:UsersRepositoryTest.php

示例3: testCreatesAppropriateFileReader

 /**
  * @dataProvider providerCreatesAppropriateFileReader
  *
  * @param string $extension
  * @param string $fileReaderClass
  */
 public function testCreatesAppropriateFileReader($extension, $fileReaderClass)
 {
     $filename = 'test' . $extension;
     $this->createTestFile($filename);
     $reader = $this->factory->create($this->getTestPath($filename));
     assertInstanceOf($fileReaderClass, $reader);
 }
开发者ID:tomphp,项目名称:config-service-provider,代码行数:13,代码来源:ReaderFactoryTest.php

示例4: testExistingChildren

 public function testExistingChildren()
 {
     // --- test load
     $this->createModels(CustomerDetail::class, []);
     $this->createModels(Customer::class, [['name' => 'Frank', 'surname' => 'Sinatra']]);
     $details = new CustomerDetail();
     $source = Datasource::make(new CustomerDetail());
     $source['id'] = 1;
     $source['biography'] = 'A nice life!';
     $source['accepts_cookies'] = 0;
     $source['customer_id'] = 1;
     $details->id = 1;
     $details->biography = 'A nice life!';
     $details->accepts_cookies = 0;
     $details->customer_id = 1;
     $source->save();
     assertTrue(isset($source['customer']));
     assertInstanceOf(Customer::class, $source['customer']);
     assertModelArrayEqual(Customer::all()->toArray(), [$source['customer']->toArray()]);
     // compare with how eloquent behaves:
     $this->createModels(CustomerDetail::class, []);
     $details->save();
     assertFalse(isset($details->customer));
     // always false!
     assertInstanceOf(Customer::class, $details->customer);
 }
开发者ID:tacone,项目名称:datasource,代码行数:26,代码来源:BelongsToOneTest.php

示例5: testInitializingObject

 public function testInitializingObject()
 {
     $configurations = ['default' => 'AwsS3', 'url' => 'https://s3.amazonaws.com', 'threshold' => 10, 'providers' => ['aws' => ['s3' => ['region' => 'us-standard', 'version' => 'latest', 'buckets' => ['my-bucket-name' => '*'], 'acl' => 'public-read', 'cloudfront' => ['use' => false, 'cdn_url' => null], 'metadata' => [], 'expires' => gmdate('D, d M Y H:i:s T', strtotime('+5 years')), 'cache-control' => 'max-age=2628000', 'version' => null]]]];
     $this->setupNonCloudfrontTest();
     $awsS3Provider_obj = $this->p_awsS3Provider->init($configurations);
     assertInstanceOf('Publiux\\laravelcdn\\Providers\\AwsS3Provider', $awsS3Provider_obj);
 }
开发者ID:publiux,项目名称:laravelcdn,代码行数:7,代码来源:AwsS3ProviderTest.php

示例6: test_it_can_login_using_username

 public function test_it_can_login_using_username()
 {
     $this->Framework->Auth->shouldReceive('attempt')->once()->andReturn(true);
     $this->UsersRepository->shouldReceive('findByUsername')->once()->andReturn($this->DvsUser);
     $input = ['uname_or_email' => 'deviseadmin', 'password' => 'secret'];
     $output = $this->SessionsRepository->login($input);
     assertInstanceOf('DvsUser', $output);
 }
开发者ID:alpas29,项目名称:cms,代码行数:8,代码来源:SessionsRepositoryTest.php

示例7: testAddExistingField

 public function testAddExistingField()
 {
     $source = [];
     $e = new Endpoint($source);
     $field = $e->string('name');
     assertInstanceOf(Field::class, $field);
     assertSame($field, $e['name']);
 }
开发者ID:tacone,项目名称:bees,代码行数:8,代码来源:EndpointTest.php

示例8: testHydrateDateTime

 public function testHydrateDateTime()
 {
     $dob = new \DateTime('1989-01-01');
     $data = array('dob' => $dob->format('U'));
     $hydratedPerson = $this->hydrator->hydrate($this->person, $data, $this->metadata);
     assertInstanceOf('DateTime', $hydratedPerson->dob);
     assertEquals('1989-01-01', $hydratedPerson->dob->format('Y-m-d'));
 }
开发者ID:tystr,项目名称:redis-orm,代码行数:8,代码来源:ObjectHydratorTest.php

示例9: test_it_creates_new_page

 public function test_it_creates_new_page()
 {
     $this->RoutesGenerator->shouldReceive('cacheRoutes')->once();
     $this->PageVersionManager->shouldReceive('createDefaultPageVersion')->times(1)->andReturn(new \DvsPageVersion());
     $page = $this->ApiPagesManager->createNewPage(['title' => 'Some page title', 'slug' => '/some-page-title', 'http_verb' => 'get', 'response_path' => 'some.path', 'response_params' => 'param1,param2']);
     assertNotFalse($page);
     assertInstanceOf('DvsPageVersion', $page->version);
     assertEquals($page->title, 'Some page title');
 }
开发者ID:alpas29,项目名称:cms,代码行数:9,代码来源:ApiPagesManagerTest.php

示例10: aSetOfChartObjectsWithOptions

 /**
  * @Given /^a set of chart objects with options$/
  */
 public function aSetOfChartObjectsWithOptions()
 {
     $obj1 = new DummyChart();
     assertInstanceOf('GoogleChartGenerator\\Mock\\DummyChart', $obj1->setTitle('Dummy Chart #1'));
     $this->mockObjects['obj1'] = $obj1;
     $this->expectedOptions['obj1'] = ["title" => "Dummy Chart #1"];
     $this->mockObjects['obj2'] = new DummyChart(['title' => 'Dummy Chart #2']);
     $this->expectedOptions['obj2'] = ['title' => 'Dummy Chart #2'];
 }
开发者ID:martinsik,项目名称:google-chart-generator,代码行数:12,代码来源:OptionsContext.php

示例11: test_it_creates_pristine_section

 public function test_it_creates_pristine_section()
 {
     $parser = new DeviseParser();
     $traverser = new NodeTraverser();
     $traverser->addVisitor(new CreatePristineSection($parser));
     $nodes = $parser->parse($this->fixture('devise-views.interpret3'));
     $nodes = $traverser->traverse($nodes);
     assertCount(1, $nodes);
     assertInstanceOf('PhpParser\\Node\\Stmt\\If_', $nodes[0]);
 }
开发者ID:alpas29,项目名称:cms,代码行数:10,代码来源:CreatePristineSectionTest.php

示例12: test_it_creates_new_page_for_spanish_language

 public function test_it_creates_new_page_for_spanish_language()
 {
     $this->PageVersionManager->shouldReceive('createDefaultPageVersion')->times(1)->andReturn(new \DvsPageVersion());
     $this->RoutesGenerator->shouldReceive('cacheRoutes')->once();
     $page = $this->PageManager->createNewPage(['title' => 'Some page title', 'slug' => '/some-page-title', 'http_verb' => 'get', 'view' => 'some.view.path', 'language_id' => 163]);
     assertNotFalse($page);
     assertInstanceOf('DvsPageVersion', $page->version);
     assertEquals($page->title, 'Some page title');
     assertEquals($page->route_name, 'es-some-page-title');
 }
开发者ID:alpas29,项目名称:cms,代码行数:10,代码来源:PageManagerTest.php

示例13: test_it_can_search_thru_items

 public function test_it_can_search_thru_items()
 {
     $mockedResult = new MockedSearchResult();
     $item1 = m::mock('Devise\\Search\\Searchable');
     $item1->shouldReceive('search')->andReturn($mockedResult);
     $this->search->register($item1);
     $outcome = $this->search->search('asdf');
     assertInstanceOf('Devise\\Search\\Pagination', $outcome);
     assertCount(1, $outcome->toArray()['items']);
 }
开发者ID:alpas29,项目名称:cms,代码行数:10,代码来源:UniversalSearchTest.php

示例14: testSetState

 public function testSetState()
 {
     $data = array('id' => 1, 'prefix' => 'some_', 'indexes' => array('index1', 'index2'), 'sortedIndexes' => array('sortedIndex1', 'sortedIndex2'), 'propertyMappings' => array(array('name' => 'property', 'type' => 'string')));
     $metadata = Metadata::__set_state($data);
     assertInstanceOf('Tystr\\RedisOrm\\Metadata\\Metadata', $metadata);
     assertEquals($data['id'], $metadata->getId());
     assertEquals($data['prefix'], $metadata->getPrefix());
     assertEquals($data['indexes'], $metadata->getIndexes());
     assertEquals($data['sortedIndexes'], $metadata->getSortedIndexes());
     assertEquals($data['propertyMappings'], $metadata->getPropertyMappings());
 }
开发者ID:tystr,项目名称:redis-orm,代码行数:11,代码来源:MetadataTest.php

示例15: testReadReturnCorrectDataType

 public function testReadReturnCorrectDataType()
 {
     $asset_holder = new \Vinelab\Cdn\Asset();
     $asset_holder->init(array('include' => ['directories' => [__DIR__]]));
     $console_output = M::mock('Symfony\\Component\\Console\\Output\\ConsoleOutput');
     $console_output->shouldReceive('writeln')->atLeast(1);
     $finder = new \Vinelab\Cdn\Finder($console_output);
     $result = $finder->read($asset_holder);
     assertInstanceOf('Symfony\\Component\\Finder\\SplFileInfo', $result->first());
     assertEquals($result, new Collection($result->all()));
 }
开发者ID:codenut,项目名称:cdn,代码行数:11,代码来源:FinderTest.php


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