Ejemplo n.º 1
0
 public function test_creating_admin()
 {
     $name = 'Battouta';
     $email = '*****@*****.**';
     $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);
 }
Ejemplo n.º 2
0
 /**
  * @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());
 }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
 /**
  * @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();
 }