Skip to content

Commit

Permalink
Merge pull request #16 from linna/b3.0.0
Browse files Browse the repository at this point in the history
Align master to b3.0.0
  • Loading branch information
s3b4stian authored Mar 23, 2021
2 parents 86b4751 + 42898a6 commit 89a494e
Show file tree
Hide file tree
Showing 13 changed files with 138 additions and 120 deletions.
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ tools:

build:
environment:
php: 7.1
php: 8.0
tests:
override:
-
Expand Down
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [v2.0.1](https://github.com/linna/typed-array/compare/v2.0.0...v2.0.1) - 2019-03-XX
## [v2.0.1](https://github.com/linna/typed-array/compare/v2.0.0...v2.0.1) - 2020-03-23

### Added
- php 7.3 support
- php 7.4 support

### Changed
- `.scrutinizer.yml` updated for use phpunit from `vendor` directory
- Merge pull request #14 from peter279k/enhance_stuffs with code enhancements

### Removed
- Travis CI usage for test build.

## [v2.0.0](https://github.com/linna/typed-array/compare/v1.0.5...v2.0.0) - 2018-08-13

### Changed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<div align="center">

[![Build Status](https://travis-ci.org/linna/typed-array.svg?branch=master)](https://travis-ci.org/linna/typed-array)
[![Tests](https://github.com/linna/typed-array/actions/workflows/tests.yml/badge.svg)](https://github.com/linna/typed-array/actions/workflows/tests.yml)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/linna/typed-array/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/linna/typed-array/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/linna/typed-array/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/linna/typed-array/?branch=master)
[![StyleCI](https://styleci.io/repos/93407083/shield?branch=master&style=flat)](https://styleci.io/repos/93407083)
Expand Down
2 changes: 1 addition & 1 deletion src/Linna/TypedArrayObject/ClassArrayObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ClassArrayObject extends ArrayObject
public function __construct(string $class, array $input = [], int $flags = 0, string $iterator_class = "ArrayIterator")
{
$this->type = $class;

if (!\class_exists($class)) {
throw new InvalidArgumentException("Type <{$this->type}> provided isn't a class.");
}
Expand Down
27 changes: 15 additions & 12 deletions tests/ArrayArrayObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,23 @@ public function testSetValueWithValidArgument(): void
{
$arrayArray = new ArrayArrayObject();
$arrayArray[] = [1,2,3];

$this->assertSame(1, $this->count($arrayArray));
$this->assertSame([1,2,3], $arrayArray[0]);
}

/**
* Test append value with valid argument.
*/
public function testAppendValueWithValidArgument(): void
{
$arrayArray = new ArrayArrayObject();
$arrayArray->append([1,2,3]);

$this->assertSame(1, $this->count($arrayArray));
$this->assertSame([1,2,3], $arrayArray[0]);
}

/**
* Provide invalid typed arrays.
*
Expand All @@ -70,7 +70,9 @@ public function invalidArrayProvider(): array
return [
//[[[1], [2]]], //array
[[true, false]], //bool
[[function () {}, function () {}]], //callable
[[function () {
}, function () {
}]], //callable
[[1.1, 2.2]], //float
[[1, 2]], //int
[[(object) ['name' => 'foo'], (object) ['name' => 'bar']]], //object
Expand All @@ -80,13 +82,13 @@ public function invalidArrayProvider(): array

/**
* Test new instance with invalid argument.
*
*
* @dataProvider invalidArrayProvider
*/
public function testNewInstanceWithInvalidArgument(array $array): void
{
$this->expectException(InvalidArgumentException::class);

$arrayArray = new ArrayArrayObject($array);
}

Expand All @@ -100,7 +102,8 @@ public function invalidValueProvider(): array
return [
//[[1]], //array
[true], //bool
[function () {}], //callable
[function () {
}], //callable
[1.1], //float
[1], //int
[(object) ['name' => 'foo']], //object
Expand All @@ -110,26 +113,26 @@ public function invalidValueProvider(): array

/**
* Test set value with invalid argument.
*
*
* @dataProvider invalidValueProvider
*/
public function testSetValueWithInvalidArgument($value): void
{
$this->expectException(InvalidArgumentException::class);

$arrayArray = new ArrayArrayObject();
$arrayArray[] = $value;
}

/**
* Test append value with invalid argument.
*
*
* @dataProvider invalidValueProvider
*/
public function testAppendValueWithInvalidArgument($value): void
{
$this->expectException(InvalidArgumentException::class);

$arrayArray = new ArrayArrayObject();
$arrayArray->append($value);
}
Expand Down
27 changes: 15 additions & 12 deletions tests/BoolArrayObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,23 @@ public function testSetValueWithValidArgument(): void
{
$boolArray = new BoolArrayObject();
$boolArray[] = false;

$this->assertSame(1, $this->count($boolArray));
$this->assertSame(false, $boolArray[0]);
}

/**
* Test append value with valid argument.
*/
public function testAppendValueWithValidArgument(): void
{
$boolArray = new BoolArrayObject();
$boolArray->append(false);

$this->assertSame(1, $this->count($boolArray));
$this->assertSame(false, $boolArray[0]);
}

/**
* Provide invalid typed arrays.
*
Expand All @@ -70,7 +70,9 @@ public function invalidArrayProvider(): array
return [
[[[1], [2]]], //array
//[[true, false]], //bool
[[function () {}, function () {}]], //callable
[[function () {
}, function () {
}]], //callable
[[1.1, 2.2]], //float
[[1, 2]], //int
[[(object) ['name' => 'foo'], (object) ['name' => 'bar']]], //object
Expand All @@ -80,13 +82,13 @@ public function invalidArrayProvider(): array

/**
* Test new instance with invalid argument.
*
*
* @dataProvider invalidArrayProvider
*/
public function testNewInstanceWithInvalidArgument(array $array): void
{
$this->expectException(InvalidArgumentException::class);

$boolArray = new BoolArrayObject($array);
}

Expand All @@ -100,7 +102,8 @@ public function invalidValueProvider(): array
return [
[[1]], //array
//[true], //bool
[function () {}], //callable
[function () {
}], //callable
[1.1], //float
[1], //int
[(object) ['name' => 'foo']], //object
Expand All @@ -110,26 +113,26 @@ public function invalidValueProvider(): array

/**
* Test set value with invalid argument.
*
*
* @dataProvider invalidValueProvider
*/
public function testSetValueWithInvalidArgument($value): void
{
$this->expectException(InvalidArgumentException::class);

$boolArray = new BoolArrayObject();
$boolArray[] = $value;
}

/**
* Test append value with invalid argument.
*
*
* @dataProvider invalidValueProvider
*/
public function testAppendValueWithInvalidArgument($value): void
{
$this->expectException(InvalidArgumentException::class);

$boolArray = new BoolArrayObject();
$boolArray->append($value);
}
Expand Down
36 changes: 21 additions & 15 deletions tests/CallableArrayObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public function testNewInstance(): void
*/
public function testNewInstanceWithValidArgument(): void
{
$this->assertInstanceOf(CallableArrayObject::class, (new CallableArrayObject([function($e){return $e+1;}])));
$this->assertInstanceOf(CallableArrayObject::class, (new CallableArrayObject([function ($e) {
return $e+1;
}])));
}

/**
Expand All @@ -42,24 +44,28 @@ public function testNewInstanceWithValidArgument(): void
public function testSetValueWithValidArgument(): void
{
$callableArray = new CallableArrayObject();
$callableArray[] = function($e){return $e+1;};

$callableArray[] = function ($e) {
return $e+1;
};

$this->assertSame(1, $this->count($callableArray));
$this->assertSame(true, is_callable($callableArray[0]));
$this->assertSame(true, \is_callable($callableArray[0]));
}

/**
* Test append value with valid argument.
*/
public function testAppendValueWithValidArgument(): void
{
$callableArray = new CallableArrayObject();
$callableArray->append(function($e){return $e+1;});

$callableArray->append(function ($e) {
return $e+1;
});

$this->assertSame(1, $this->count($callableArray));
$this->assertSame(true, is_callable($callableArray[0]));
$this->assertSame(true, \is_callable($callableArray[0]));
}

/**
* Provide invalid typed arrays.
*
Expand All @@ -80,13 +86,13 @@ public function invalidArrayProvider(): array

/**
* Test new instance with invalid argument.
*
*
* @dataProvider invalidArrayProvider
*/
public function testNewInstanceWithInvalidArgument(array $array): void
{
$this->expectException(InvalidArgumentException::class);

$callableArray = new CallableArrayObject($array);
}

Expand All @@ -110,26 +116,26 @@ public function invalidValueProvider(): array

/**
* Test set value with invalid argument.
*
*
* @dataProvider invalidValueProvider
*/
public function testSetValueWithInvalidArgument($value): void
{
$this->expectException(InvalidArgumentException::class);

$callableArray = new CallableArrayObject();
$callableArray[] = $value;
}

/**
* Test append value with invalid argument.
*
*
* @dataProvider invalidValueProvider
*/
public function testAppendValueWithInvalidArgument($value): void
{
$this->expectException(InvalidArgumentException::class);

$callableArray = new CallableArrayObject();
$callableArray->append($value);
}
Expand Down
Loading

0 comments on commit 89a494e

Please sign in to comment.