Example #1
0
 public function testDecribesPropertySettingInMismatchMessage()
 {
     $this->assertMismatchDescription('was not set', set('bar'), array('foo' => 'bar'));
     $this->assertMismatchDescription('was "bar"', notSet('foo'), array('foo' => 'bar'));
     self::$_classProperty = 'bar';
     $this->assertMismatchDescription('was "bar"', notSet('_classProperty'), 'Hamcrest\\Core\\SetTest');
     $this->_instanceProperty = 'bar';
     $this->assertMismatchDescription('was "bar"', notSet('_instanceProperty'), $this);
 }
 public function testSetModelProperties()
 {
     $stub = Mockery::mock('PullAutomaticallyGalleries\\RemoteApi\\RemoteApiModelInterface')->shouldReceive('setAuth')->with(['foo'])->once()->andReturn(Mockery::self())->shouldReceive('find')->with('1')->once()->andReturn($this->galleryStub)->getMock();
     $mock = Test::double('RemoteGallery', ['newModel' => $stub]);
     $gallery = RemoteGallery::find('DummyHost', ['foo'], '1');
     assertThat($gallery, set('pal_user_id'));
     assertThat($gallery, set('pal_gallery_id'));
     assertThat($gallery, set('post_content'));
     assertThat($gallery, set('post_title'));
     assertThat($gallery, set('post_date'));
     assertThat($gallery, notSet('id'));
     assertThat($gallery, notSet('user_id'));
     assertThat($gallery, notSet('description'));
     assertThat($gallery, notSet('created'));
     assertThat($gallery, notSet('title'));
 }
 public function testGetByUsersReturnsOnlySelectedFields()
 {
     Factory::create('Gallery');
     Factory::create('PostMeta', ['post_id' => 1, 'meta_value' => 1]);
     Factory::create('User', ['id' => 1]);
     $galleries = Gallery::getByUsers([1], ['ID']);
     assertThat($galleries[0], set('ID'));
     assertThat($galleries[0], notSet('post_author'));
     assertThat($galleries[0], notSet('post_content'));
     assertThat($galleries[0], notSet('post_title'));
     assertThat($galleries[0], notSet('post_date'));
     assertThat($galleries[0], notSet('post_status'));
     assertThat($galleries[0], notSet('post_name'));
 }