Example #1
0
 public function testGetAll()
 {
     $p = new Project($this->container);
     $f = new File($this->container);
     $tc = new TaskCreation($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'test')));
     $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test')));
     $this->assertEquals(1, $f->create(1, 'B.pdf', '/tmp/foo', 10));
     $this->assertEquals(2, $f->create(1, 'A.png', '/tmp/foo', 10));
     $this->assertEquals(3, $f->create(1, 'D.doc', '/tmp/foo', 10));
     $this->assertEquals(4, $f->create(1, 'C.JPG', '/tmp/foo', 10));
     $files = $f->getAll(1);
     $this->assertNotEmpty($files);
     $this->assertCount(4, $files);
     $this->assertEquals('A.png', $files[0]['name']);
     $this->assertEquals('B.pdf', $files[1]['name']);
     $this->assertEquals('C.JPG', $files[2]['name']);
     $this->assertEquals('D.doc', $files[3]['name']);
     $files = $f->getAllImages(1);
     $this->assertNotEmpty($files);
     $this->assertCount(2, $files);
     $this->assertEquals('A.png', $files[0]['name']);
     $this->assertEquals('C.JPG', $files[1]['name']);
     $files = $f->getAllDocuments(1);
     $this->assertNotEmpty($files);
     $this->assertCount(2, $files);
     $this->assertEquals('B.pdf', $files[0]['name']);
     $this->assertEquals('D.doc', $files[1]['name']);
 }