createSuite() public static method

public static createSuite ( array $options = [], $suiteIndex = null )
$options array
Example #1
0
 /**
  * It should delete a specified run and all of its relations.
  */
 public function testDelete()
 {
     $suiteCollection = new SuiteCollection([TestUtil::createSuite(['uuid' => 1234, 'subjects' => ['one', 'two'], 'env' => ['system' => ['os' => 'linux', 'distribution' => 'debian']]])]);
     $this->persister->persist($suiteCollection);
     $counts = $this->getTableCounts();
     $this->assertEquals(['run' => 1, 'subject' => 2, 'variant' => 2, 'parameter' => 1, 'variant_parameter' => 2, 'sgroup_subject' => 6, 'environment' => 2, 'iteration' => 4, 'version' => 1], $counts);
     $this->repository->deleteRun(1234);
     $counts = $this->getTableCounts();
     $this->assertEquals(['run' => 0, 'subject' => 2, 'variant' => 0, 'parameter' => 1, 'variant_parameter' => 0, 'sgroup_subject' => 6, 'environment' => 0, 'iteration' => 0, 'version' => 1], $counts);
 }
Example #2
0
 /**
  * The PHPBench version should be stored in the database.
  */
 public function testPhpBenchVersion()
 {
     $suiteCollection = new SuiteCollection([TestUtil::createSuite(['uuid' => 1])]);
     $this->persister->persist($suiteCollection);
     $rows = $this->sqlQuery('SELECT * FROM version');
     $this->assertCount(1, $rows);
     $row = current($rows);
     $this->assertEquals(PhpBench::VERSION, $row['phpbench_version']);
     $suiteCollection = new SuiteCollection([TestUtil::createSuite(['uuid' => 2])]);
     $this->persister->persist($suiteCollection);
     $this->assertEquals(1, $this->sqlCount('SELECT * FROM version'));
 }
 /**
  * It should iterate over the history.
  */
 public function testHistoryStatement()
 {
     $suiteCollection = new SuiteCollection([TestUtil::createSuite(['uuid' => 1, 'env' => ['vcs' => ['system' => 'git', 'branch' => 'branch_1']], 'name' => 'one', 'date' => '2016-01-01']), TestUtil::createSuite(['uuid' => 2, 'date' => '2015-01-01', 'env' => ['vcs' => ['system' => 'git', 'branch' => 'branch_2']], 'name' => 'two'])]);
     $this->persister->persist($suiteCollection);
     $current = $this->iterator->current();
     $this->assertInstanceOf('PhpBench\\Storage\\HistoryEntry', $current);
     $this->assertEquals('2016-01-01', $current->getDate()->format('Y-m-d'));
     $this->assertEquals('branch_1', $current->getVcsBranch());
     $this->assertEquals('one', $current->getContext());
     $this->assertEquals(1, $current->getRunId());
     $this->iterator->next();
     $current = $this->iterator->current();
     $this->assertInstanceOf('PhpBench\\Storage\\HistoryEntry', $current);
     $this->assertEquals('2015-01-01', $current->getDate()->format('Y-m-d'));
     $this->assertEquals('branch_2', $current->getVcsBranch());
     $this->assertEquals('two', $current->getContext());
     $this->assertEquals(2, $current->getRunId());
 }
Example #4
0
 /**
  * It should filer by groups.
  */
 public function testFilterGroups()
 {
     $suiteCollection = new SuiteCollection([TestUtil::createSuite(['uuid' => '1', 'benchmark' => ['benchOne'], 'subjects' => ['benchOne'], 'groups' => ['one', 'two']]), TestUtil::createSuite(['uuid' => '2', 'benchmark' => ['benchOne'], 'subjects' => ['benchTwo', 'benchThree'], 'groups' => ['foobar']])]);
     $this->persister->persist($suiteCollection);
     $suiteCollection = $this->loader->load(new Comparison('$eq', 'group', 'one'));
     $suite = $suiteCollection->getIterator()->current();
     $this->assertNotNull($suite);
     $this->assertCount(1, $suite->getSubjects());
     $suiteCollection = $this->loader->load(new Comparison('$eq', 'group', 'two'));
     $suite = $suiteCollection->getIterator()->current();
     $this->assertCount(1, $suite->getSubjects());
     $suiteCollection = $this->loader->load(new Comparison('$eq', 'group', 'foobar'));
     $suite = $suiteCollection->getIterator()->current();
     $this->assertCount(2, $suite->getSubjects());
 }