Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified composer.json
100644 → 100755
Empty file.
Empty file modified composer.lock
100644 → 100755
Empty file.
Empty file modified composer.phar
100644 → 100755
Empty file.
Empty file modified phpunit.xml
100644 → 100755
Empty file.
Empty file modified src/Example.php
100644 → 100755
Empty file.
53 changes: 53 additions & 0 deletions src/Variable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php


namespace koans;


class Variable
{

const CONSTANTE = 2;

/**
* Variable constructor.
*/
public function __construct()
{
}

public function declareAnInt()
{
$intVariable = "1";

return $intVariable;
}

public function declareABoolean()
{
$booleanVariable = "true";

return $booleanVariable;
}

public function declareAFloat()
{
$floatVariable = "2.5";

return $floatVariable;
}

public function declareAnArray()
{
$arrayVariable = "[1, 2 ,3]";

return $arrayVariable;
}

public function declareAnIntWithNullValue()
{
$intVariable = (int) null;

return $intVariable;
}
}
8 changes: 7 additions & 1 deletion tests/ExampleTest.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,11 @@

final class ExampleTest extends TestCase
{

/**
* @test
*/
public function assertsFalse() {
$this->assertFalse(true);
$this->assertIsInt('2');
}
}
67 changes: 67 additions & 0 deletions tests/VariableTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

namespace Deg540\koans\Test;

use koans\Variable;
use PHPUnit\Framework\TestCase;

class VariableTest extends TestCase
{
/**
* @test
**/
public function declareAnInt()
{
$variable = new Variable();
$integerValue = $variable->declareAnInt();

$this->assertIsInt($integerValue);
}

/**
* @test
**/
public function declareABoolean()
{
$variable = new Variable();
$booleanValue = $variable->declareABoolean();

$this->assertIsBool($booleanValue);
}

/**
* @test
**/
public function declareAFloat()
{
$variable = new Variable();
$floatValue = $variable->declareAFloat();

$this->assertIsFloat($floatValue);
}

/**
* @test
**/
public function declareAnArray()
{
$variable = new Variable();
$arrayValue = $variable->declareAnArray();

$this->assertIsArray($arrayValue);
}

/**
* @test
**/
public function declareAnIntWithNullValue()
{
$variable = new Variable();
$intValue = $variable->declareAnIntWithNullValue();

$this->assertIsInt($intValue);
$this->assertEquals(null, $intValue);
}


}