Skip to content

Commit

Permalink
Merge pull request #1 from peter279k/initial_tests
Browse files Browse the repository at this point in the history
Initial tests
  • Loading branch information
MirazMac authored Feb 2, 2018
2 parents 4688ff7 + 0ef21db commit dcf106b
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false
indent_style = space
indent_size = 4
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: php
php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- nightly

before_script:
- composer install

script:
- ./vendor/bin/phpunit --coverage-text
8 changes: 8 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@
"MirazMac\\BanglaString\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"MirazMac\\BanglaString\\": "tests/"
}
},
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8"
}
}
17 changes: 17 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php" colors="true" backupGlobals="false"
backupStaticAttributes="false" syntaxCheck="false">
<testsuites>
<testsuite name="Tests">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="false">
<directory suffix=".php">src</directory>
<exclude>
<file>src/autoload.php</file>
</exclude>
</whitelist>
</filter>
</phpunit>
41 changes: 41 additions & 0 deletions tests/BanglaStringTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace MirazMac\BanglaString;

use PHPUnit\Framework\TestCase;

class BanglaStringTest extends TestCase
{
protected $banglaStr;

public function setUp()
{
$this->banglaStr = new BanglaString('hello');
}

public function tearDown()
{
$this->banglaStr = null;
}

public function testTranslate()
{
$this->assertInstanceOf('MirazMac\BanglaString\BanglaString', BanglaString::translate('hello'));
}

public function testToBijoy()
{
$this->assertEquals('hello', $this->banglaStr->toBijoy('Ahello'));
}

public function testToAvro()
{
$this->assertEquals('যবষষড়', $this->banglaStr->toAvro('hello'));
}

public function testBanglaStringWithInvalidString()
{
$this->setExpectedException('\InvalidArgumentException');
$banglaStr = new BanglaString(10);
}
}

0 comments on commit dcf106b

Please sign in to comment.