本文整理汇总了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);
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例7: testAddExistingField
public function testAddExistingField()
{
$source = [];
$e = new Endpoint($source);
$field = $e->string('name');
assertInstanceOf(Field::class, $field);
assertSame($field, $e['name']);
}
示例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'));
}
示例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');
}
示例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'];
}
示例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]);
}
示例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');
}
示例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']);
}
示例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());
}
示例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()));
}