|
@@ -1,6 +1,7 @@
|
|
|
<?php
|
|
<?php
|
|
|
|
|
|
|
|
namespace Alcaeus\MongoDbAdapter\Tests;
|
|
namespace Alcaeus\MongoDbAdapter\Tests;
|
|
|
|
|
+use Alcaeus\MongoDbAdapter\TypeInterface;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @author alcaeus <alcaeus@alcaeus.org>
|
|
* @author alcaeus <alcaeus@alcaeus.org>
|
|
@@ -13,7 +14,17 @@ class MongoBinDataTest extends TestCase
|
|
|
$this->assertAttributeSame('foo', 'bin', $bin);
|
|
$this->assertAttributeSame('foo', 'bin', $bin);
|
|
|
$this->assertAttributeSame(\MongoBinData::FUNC, 'type', $bin);
|
|
$this->assertAttributeSame(\MongoBinData::FUNC, 'type', $bin);
|
|
|
|
|
|
|
|
- $this->assertSame('<Mongo Binary Data>', (string) $bin);
|
|
|
|
|
|
|
+ $this->assertSame('<Mongo Binary Data>', (string)$bin);
|
|
|
|
|
+
|
|
|
|
|
+ return $bin;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @depends testCreate
|
|
|
|
|
+ */
|
|
|
|
|
+ public function testConvertToBson(\MongoBinData $bin)
|
|
|
|
|
+ {
|
|
|
|
|
+ $this->skipTestUnless($bin instanceof TypeInterface);
|
|
|
|
|
|
|
|
$bsonBinary = $bin->toBSONType();
|
|
$bsonBinary = $bin->toBSONType();
|
|
|
$this->assertInstanceOf('MongoDB\BSON\Binary', $bsonBinary);
|
|
$this->assertInstanceOf('MongoDB\BSON\Binary', $bsonBinary);
|
|
@@ -24,6 +35,8 @@ class MongoBinDataTest extends TestCase
|
|
|
|
|
|
|
|
public function testCreateWithBsonBinary()
|
|
public function testCreateWithBsonBinary()
|
|
|
{
|
|
{
|
|
|
|
|
+ $this->skipTestUnless(in_array(TypeInterface::class, class_implements('MongoBinData')));
|
|
|
|
|
+
|
|
|
$bsonBinary = new \MongoDB\BSON\Binary('foo', \MongoDB\BSON\Binary::TYPE_UUID);
|
|
$bsonBinary = new \MongoDB\BSON\Binary('foo', \MongoDB\BSON\Binary::TYPE_UUID);
|
|
|
$bin = new \MongoBinData($bsonBinary);
|
|
$bin = new \MongoBinData($bsonBinary);
|
|
|
|
|
|