public function testGettingNewCollection()
 {
     $collection = new TestCollection();
     $this->assertInstanceOf(TestCollection::class, $collection->getNewCollection());
     $collection = new Collection();
     $this->assertInstanceOf(Collection::class, $collection->getNewCollection());
 }
예제 #2
0
 /**
  * @throws \Exception
  * @return TestCollection
  */
 public function load()
 {
     $result = $this->client->tests();
     $tests = new TestCollection();
     foreach ($result as $test) {
         if (!preg_match('/^[0-9]+\\./', $test->name, $m)) {
             continue;
         }
         $tests[] = new Test($this->client, $test);
     }
     $tests->sort();
     return $tests;
 }
예제 #3
0
 public function testCollection()
 {
     $collection = new TestCollection(array(new Record(), new Record()));
     $collection->add(new Record());
     $this->assertInstanceOf('PSX\\Data\\CollectionInterface', $collection);
     $this->assertEquals(3, $collection->count());
     $this->assertEquals(3, count($collection));
     $this->assertFalse($collection->isEmpty());
     $this->assertEquals(null, $collection->get(3));
     $collection->set(3, new Record());
     $this->assertInstanceOf('PSX\\Data\\RecordInterface', $collection->get(3));
     foreach ($collection as $record) {
         $this->assertInstanceOf('PSX\\Data\\RecordInterface', $record);
     }
     $collection->clear();
     $this->assertEquals(0, $collection->count());
     $this->assertEquals(array(), $collection->toArray());
     $this->assertTrue($collection->isEmpty());
 }