Skip to content

Commit

Permalink
Added codeception and new test suite
Browse files Browse the repository at this point in the history
Moved the Version unit test in codeception suite
Added getParts and constants in the Version component
  • Loading branch information
niden committed Sep 4, 2014
1 parent 15e1a4a commit e6b5e7e
Show file tree
Hide file tree
Showing 20 changed files with 2,726 additions and 39 deletions.
Binary file added codecept.phar
Binary file not shown.
17 changes: 17 additions & 0 deletions codeception.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
helpers: tests/_support
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
modules:
config:
Db:
dsn: ''
user: ''
password: ''
dump: tests/_data/dump.sql
2 changes: 2 additions & 0 deletions tests/_bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
// This is global bootstrap for autoloading
1 change: 1 addition & 0 deletions tests/_data/dump.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* Replace this file with actual dump of your database */
Empty file added tests/_output/.gitignore
Empty file.
10 changes: 10 additions & 0 deletions tests/_support/AcceptanceHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
namespace Codeception\Module;

// here you can define custom actions
// all public methods declared in helper class will be available in $I

class AcceptanceHelper extends \Codeception\Module
{

}
10 changes: 10 additions & 0 deletions tests/_support/FunctionalHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
namespace Codeception\Module;

// here you can define custom actions
// all public methods declared in helper class will be available in $I

class FunctionalHelper extends \Codeception\Module
{

}
10 changes: 10 additions & 0 deletions tests/_support/UnitHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
namespace Codeception\Module;

// here you can define custom actions
// all public methods declared in helper class will be available in $I

class UnitHelper extends \Codeception\Module
{

}
102 changes: 102 additions & 0 deletions tests/_support/Verify.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php

namespace Codeception;

use \PHPUnit_Framework_Assert as a;

class Verify
{

protected $actual = null;
protected $description = '';

public function __construct($description, $actual = null)
{
if (!$actual) {
$this->actual = $description;
} else {
$this->actual = $actual;
$this->description = $description;
}
}

public function equals($expected)
{
a::assertEquals($expected, $this->actual, $this->description);
}

public function notEquals($expected)
{
a::assertNotEquals($expected, $this->actual, $this->description);
}

public function contains($needle)
{
a::assertContains($needle, $this->actual, $this->description);
}

public function notContains($needle)
{
a::assertNotContains($needle, $this->actual, $this->description);
}

public function greaterThan($expected)
{
a::assertGreaterThan($expected, $this->actual, $this->description);
}

public function lessThen($expected)
{
a::assertLessThan($expected, $this->actual, $this->description);
}

public function greaterOrEquals($expected)
{
a::assertGreaterThanOrEqual($expected, $this->actual, $this->description);
}

public function lessOrEquals($expected)
{
a::assertLessThanOrEqual($expected, $this->actual, $this->description);
}

public function true()
{
a::assertTrue($this->actual, $this->description);
}

public function false()
{
a::assertFalse($this->actual, $this->description);
}

public function null()
{
a::assertNull($this->actual, $this->description);
}

public function notNull()
{
a::assertNotNull($this->actual, $this->description);
}

public function isEmpty()
{
a::assertEmpty($this->actual, $this->description);
}

public function notEmpty()
{
a::assertNotEmpty($this->actual, $this->description);
}

public function hasKey($key)
{
a::assertArrayHasKey($key, $this->actual, $this->description);
}

public function hasntKey($key)
{
a::assertArrayNotHasKey($key, $this->actual, $this->description);
}
}
14 changes: 14 additions & 0 deletions tests/acceptance.suite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Codeception Test Suite Configuration

# suite for acceptance tests.
# perform tests in browser using the WebDriver or PhpBrowser.
# If you need both WebDriver and PHPBrowser tests - create a separate suite.

class_name: AcceptanceTester
modules:
enabled:
- PhpBrowser
- AcceptanceHelper
config:
PhpBrowser:
url: 'http://localhost/myapp/'
Loading

0 comments on commit e6b5e7e

Please sign in to comment.