Пример #1
0
 public function testEntityMustBeMarkedAsDirty()
 {
     $data = ['id' => 2, 'name' => 'Foo Bar'];
     $dirty = ['id' => 10, 'name' => 'Biz Baz'];
     $stub = new EntityStub($data);
     $stub->setId($dirty['id']);
     $stub->setName($dirty['name']);
     $this->assertTrue($stub->isDirty());
     $this->assertEquals($dirty, $stub->getDirty());
 }
Пример #2
0
 public function testToJsonReturnsJson()
 {
     $entity = new EntityStub(['name' => 'Hello world']);
     $this->assertEquals('{"name":"Hello world"}', $entity->toJson());
 }
Пример #3
0
 /** @test */
 public function it_can_retrieve_the_available_attributes()
 {
     $entity = new EntityStub();
     $entity->exists = true;
     $entity->abc = 'foobar';
     $entity->getConnection()->getQueryGrammar()->shouldReceive('compileSelect')->once();
     $entity->getConnection()->shouldReceive('select')->once();
     $entity->getConnection()->getPostProcessor()->shouldReceive('processSelect')->once()->andReturn($builder = m::mock('Illuminate\\Database\\Query\\Builder'));
     $this->assertInstanceOf('Illuminate\\Support\\Collection', $entity::availableAttributes());
 }