本文整理汇总了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);
}
示例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());
}
示例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);
}
示例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();
}