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


PHP Mockery::subset方法代码示例

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


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

示例1: test_creating_admin

 public function test_creating_admin()
 {
     $name = 'Battouta';
     $email = 'battouta@disney.ass';
     $this->mAdmin->shouldReceive('create')->with(M::subset(['name' => $name, 'email' => $email]))->andReturn($this->mAdmin);
     $admin = $this->admins->create($name, $email);
     $this->assertInstanceOf('Agency\\Cms\\Admin', $admin);
     $this->assertObjectNotHasAttribute('password', $admin);
     $this->assertNotNull($admin->raw_password);
 }
开发者ID:vinelab,项目名称:agency,代码行数:10,代码来源:AdminRepositoryTest.php

示例2: it_can_subscribe_someone_to_a_list

 /**
  * @test
  */
 public function it_can_subscribe_someone_to_a_list()
 {
     $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
     $subscriber = new Subscriber($this->faker->name, $this->faker->email, $this->faker->phoneNumber);
     $subscriber->setTags('a,b');
     $data = ['fields' => ['Name' => $subscriber->getName(), 'email' => $subscriber->getEmail(), 'phone' => $subscriber->getPhone()], 'tags' => 'a,b', 'request_ip' => '127.0.0.1', 'request_time' => date('Y-m-d'), 'list_ids' => '1111,2222', 'double_optin' => 3, 'overwrite' => 0];
     $expectation = ['result' => ['person_id' => 2500767342]];
     $this->api->shouldReceive('subscribe')->with(\Mockery::subset($data))->andReturn($expectation);
     $response = $this->model->subscribe($subscriber, [1111, 2222]);
     self::assertEquals($expectation, $response->getApiResponse());
 }
开发者ID:kotchuprik,项目名称:yii2-unisender,代码行数:14,代码来源:UniSenderTest.php

示例3: test_creating_image

 public function test_creating_image()
 {
     $this->mImage->shouldReceive('presetType')->with('original')->andReturn('original');
     $this->mImage->shouldReceive('presetType')->with('thumbnail')->andReturn('thumbnail');
     $this->mImage->shouldReceive('presetType')->with('square')->andReturn('square');
     $this->mImage->shouldReceive('presetType')->with('small')->andReturn('small');
     $original = M::mock('Agency\\Media\\Photos\\Photo');
     $original->url = 'http://placekitten.com/1024/768';
     $thumbnail = M::mock('Agency\\Media\\Photos\\Photo');
     $thumbnail->url = 'http://placekitten.com/300/200';
     $small = M::mock('Agency\\Media\\Photos\\Photo');
     $small->url = 'http://pacekitten.com/320/128';
     $square = M::mock('Agency\\Media\\Photos\\Photo');
     $square->url = 'http://plackitten.com/200/200';
     $this->mImage->shouldReceive('create')->with(M::subset(['original' => $original->url, 'thumbnail' => $thumbnail->url, 'small' => $small->url, 'square' => $square->url]))->andReturn($this->mImage);
     $original_image = $this->images->create($original, $thumbnail, $small, $square);
     $this->assertInstanceOf('Agency\\Contracts\\ImageInterface', $original_image);
 }
开发者ID:vinelab,项目名称:agency,代码行数:18,代码来源:ImageRepositoryTest.php

示例4: testArrayContentConstraintThrowsExceptionWhenConstraintUnmatched

 /**
  * @expectedException \Mockery\Exception
  */
 public function testArrayContentConstraintThrowsExceptionWhenConstraintUnmatched()
 {
     $this->mock->shouldReceive('foo')->with(Mockery::subset(array('a' => 1, 'b' => 2)))->once();
     $this->mock->foo(array('a' => 1, 'c' => 3));
     $this->container->mockery_verify();
 }
开发者ID:carriercomm,项目名称:CraigslistX,代码行数:9,代码来源:ExpectationTest.php


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